What does the delay keyword ?
The delay keyword does nothing more than stop the execution of the current stack and immediately continues to the next task in the queue. But that's not all! Instead of discarding the stack, it adds it to the end of the queue. After all tasks before it are done, the stack continues to execute.
What is it good for?
delay could help make blocking code non-blocking while it still looks like synchronous code. A short example:
delay; //since there is currently another task in the queue, do this task first before continuing
//Outputs: one, two, three
This simple keyword would allow us to create a synchronous-looking code wich is asynchronous behind the scenes. Using node.js modules, for example, would no longer be impossible to use in the browser without trickery.
There would be so many possibilites with such a keyword!
Please disuss as much as you want! :)
If you want to trigger discussion of this idea you should make a post. to email@example.com
If you aren't already a member of that discussion list you can enroll at https://mail.mozilla.org/listinfo/es-discuss/
I've already done that, thanks. I hope it will succeed :)
moved to Harmony product because this isn't a approved feature for ES6
Bulk closing all Harmony bugs. Proposals should be tracked on GitHub. The ES wiki is completely defunct at this point.