-
Notifications
You must be signed in to change notification settings - Fork 353
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 methods for calling interpreted functions #201
base: master
Are you sure you want to change the base?
Conversation
[EDIT] No longer applicable |
EDIT: No longer applicable |
I think I ironed out all the bugs now. |
@NeilFraser: do you want to consider this PR? The topic of implementing If you're interested in considering it I'm happy to give it a careful review as a second pair of eyes if you like. |
I merged it with all the recent changes, but I'm not sure it's working correctly. Don't have time to test right now. |
Allows calling anonymous interpreted functions from native code.
(Includes changes in #193)
fixes #192, resolves #199, closes #147, closes #189,
Examples:
Synchronous callback from native function:
Synchronous callback from native AsyncFunction:
In both cases above, the
.then(...)
callback value handler is optional. If omitted, the value of the called interpreted function will be returned.Additional pseudo functions can be called by simply returning another Callback in the
.then()
handler viareturn interpreter.callFunction(...)
For example:
or:
Queued via queueFunction: (func is called last.)
Queued Callbacks:
Throwing exception in native AsyncFunction:
Throwing exception in native function: (Alternate to interpreter.throwException(...))
Catching exceptions in pseudo function calls from native:
Catching exceptions in pseudo function calls from native async:
Chaining thens in functions calls from native:
Implementing native timers example:
Use Callbacks in AsyncFuntion, full example:
Use Callbacks in Native Function, full example: