Async handling #5167
Replies: 1 comment
-
Posted at 2015-11-28 by tve Thanks for posting! Calling And that makes it impossible to nest async's, right? Posted at 2015-11-28 by JumJum I tried to nest asyncs some time ago, and failed :-( Posted at 2015-11-28 by @allObjects It's nice to see the job getting done... for the price of 5 globals... not bad. Reduce the 5 to 1 in the spirit of object-orientation helps with clean-up and passing the one as parm to the sequence defining application functions (async1..4) would conribute to hardening. I liked the naming in Kazimir's original post: queue... and that it is: queing of sets of asynch operations that have to complete one after the other before a next set is allowed to be entered, and finally chaining these sets. In some of my implementatins I needed result-dependent follow-up async operation(s) to be completed before the next set could be entered, and therefore allowed an insertion into or append to the funcs array. The effect is similar to a pseudo-multi-level / quasi-context creation (easy to implement by enhancing the next() to accept optionally the required parameters to do it). Surfing the subject shows many implementations with various focus. @jumjum, what is the Posted at 2015-11-28 by tve Mhh, I have to read Kazimir's original post... |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2014-12-31 by JumJum
Promises are a powerful tool to avoid callback-hell.
For Espruino I was searching for a tiny solution and found 7 Lines from Krasimir.
Based on this I wrote a simple flow solution.
It supports
Handling is simple as you can see here:
Beta Was this translation helpful? Give feedback.
All reactions