You are reading a single comment by @maze1980 and its replies. Click here to read the full conversation.
  • @allObject: The two blocks "After n seconds do" and "Every n seconds do" are already there. I'm not sure why you introduced scheduleOnce() and scheduleRepeated(), do you want them as js functions or blocky, and how would they differ from the existing js functions setTimeout/setInterval or the existing blocks?

  • Sun 2019.06.23

    @maze1980, I see that you are a recent member to the forums, forgive me if explaining this implies otherwise.

    While I'll defer to @allObjects for an author official explanation, and while his availability is rather limited, and a considerable amount of effort went into laying out that content, . . . IMO if you'll note, his last paragraph was addressed to Gordon, . . . 'for example' . . . and as a suggestion with content to enhance Espruino and not directly meant to change how the core Javascript is defined.



    In your explanation #13 my interpretation is that I believe that you believe the difference, but the explanation needs a bit of cleanup.

    Excellent article:

    https://johnresig.com/blog/how-javascrip­t-timers-work/

    ref #13 ' if there's any function triggered while a "sleep" function is "active" that function will be executed.'

    ref #14 @AkosLukacs 'executes on one thread'

    From the article and the above post, the 'actual' code is 'queued', along with the event, and running in a single thread. So there isn't a guarantee the function will be executed immediately as in your explanation.

About

Avatar for maze1980 @maze1980 started