-
-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more samples in README #289
base: master
Are you sure you want to change the base?
Conversation
README.md
Outdated
``` | ||
|
||
### Resolve JavaScript Promise in Go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example isn't resolving the promise in Go, it is just getting the result.
printfn := v8.NewFunctionTemplate(iso, func(info *v8.FunctionCallbackInfo) *v8.Value { | ||
fmt.Printf("%v", info.Args()) // when the JS function is called this Go callback will execute | ||
return nil // you can return a value back to the JS caller if required | ||
addFn := v8.NewFunctionTemplate(iso, func(info *v8.FunctionCallbackInfo) *v8.Value { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this example changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this example changed?
add sample return real value to js
I wonder if it's more practical in the long term to keep the examples in the readme minimal. The tests cover almost all of the common usecases including returning a value in the function template, handling the arguments to a function, and getting the returned val as a promise. The benefit of leaning on tests is that they have to compile and work for the code on a given commit (in order to pass CI) so the tests will reflect the expected usage of the code. Markdown can more easily get out of date. |
add two useful samples in readme