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 obj's purpose in line 46? Espruino is reporting it undefined...
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
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
obj
's purpose in line 46? Espruino is reporting it undefined...