Async control flow "library" #239
Replies: 7 comments
-
Posted at 2014-03-21 by @gfwilliams Thanks! It could make a good module. Does the code you have work in normal JavaScript? If so, and you find out why it doesn't work in Espruino, please can you let me know? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-03-23 by ChrisB Hi Gordon,
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-03-23 by ChrisB Using the library is working like this :
but fails like this
En error message from Espruino says that it reached the stack limitation for recursivity functions. Even if I can make the code working, I'm afraid the board has not enough 'power' or memory. What do you think ? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-03-24 by @gfwilliams Hmm. Well, it won't like having lots of recursion... For instance unless I'm misunderstanding, what you're doing could actually be handled using:
(although obviously that would quickly exhaust the stack - although it could be changed to use setTimeout pretty easily) The actual bugs with Espruino seem to be:
I'll see if I can fix the first 2 for 1v59 - the other one's going to need a bit more work :) By the way,
Which is what Espruino does. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-03-24 by ChrisB I agree that async.js might be a bit heavy for the simple fact of doing series :) Thanks for fixing the first two points. But for me the for(.... in ... ) is also "wrong" ? In the code I'm ususally do it used to return the value (the item) and not the index (as an integer) in the array.
Is Espruino "standard" javascript ? or is it mine code that is not standard :) ? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-03-24 by @gfwilliams Yes, the first point will fix all 3 of those lines :) I think your code is the non-standard one - [click here to try it out on jsconsole and see what happens](http://www.jsconsole.com/?for%20(var%20i%20in%20%5B%22a%22%2C%22b%22%2C%22c%22%5D%29%20console.log(i%29) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-03-26 by rwaldron Regarding:
This is incorrect. for-in will assign the value of the "key" (in this case the numeric index) to This is correct:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-03-20 by ChrisB
Used to work with node.js Async library and like this library.
Having to do lot of asynchronous (so with callback) chaining functions in my project,
such library might miss in Espruino.
Example of async.js library transfered :
If something similar is already present in Espruino, let me know...
Any question or feedback, please let me know...
I planned to use functions around control flow for the moment.
[EDITED]
PS : Sorry.... :(
the code is not working so well..... I'll update it once fully working
Beta Was this translation helpful? Give feedback.
All reactions