4 ms·
It seems to depend on reactivity[1], hence it doesn't block. Here's an example: https://jsfiddle.net/k61y5sLo/2/ https://jsfiddle.net/k61y5sLo/2/ Pre-call
by virulent 11y ago
It seems to depend on reactivity[1], hence it doesn't block.
Here's an example: https://jsfiddle.net/k61y5sLo/2/ https://jsfiddle.net/k61y5sLo/2/
Pre-callback
Evaluating getCallbackText()
Post-callback
callbackTest => cb("Alice")
Evaluating getCallbackText()
callbackTest => cb("Bob")
Evaluating getCallbackText()
Callback returned: Alice Bob
https://github.com/aldonline/reactivity https://github.com/aldonline/reactivity
- zackmorris 11y agoThanks for the example. Just to clarify, it appears that you used syncify.revert(getCallbackText) to to create a callback from a synchronous function in order to log the final result. So it looks like Syncify.js evaluates the parent getCallbackText() function each time that one of its child callbackTest("Alice") or callbackTest("Bob") functions fire. Conceptually it replaces instantiations of callbackTest() with their return values. So on the final pass there are no more child functions to evaluate and it can return the final value. If this all sounds correct (and please correct me if I'm wrong) then the tradeoff is some re-run overhead in order to skip having to deal with promises or yield/generators.