Add methods for calling interpreted functions#201
Closed
Webifi wants to merge 68 commits intoNeilFraser:masterfrom
Webifi:master
Closed
Add methods for calling interpreted functions#201Webifi wants to merge 68 commits intoNeilFraser:masterfrom Webifi:master
Webifi wants to merge 68 commits intoNeilFraser:masterfrom
Webifi:master
Conversation
Author
|
[EDIT] No longer applicable |
Author
|
EDIT: No longer applicable |
Author
Author
|
I think I ironed out all the bugs now. |
Collaborator
|
@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. |
Author
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: