StratifiedJS

StratifiedJS (http://onilabs.com/stratifiedjs) is an alternative to the await/defer paradigm that offers finer-grained control structures, with intuitive names like waitfor and resume.

​ 
console.log(​'this code will run right away...'​);
​ 
waitfor() {
​ 
setTimeout(resume, 500);
​ 
}
​ 
console.log(​'...and this will run 500ms later.'​);

Although not widely used, StratifiedJS is an ambitious project that’s received praise from the likes of John Resig (the creator of jQuery).[62] Note that StratifiedJS is the name of the specification, not the implementation; the official reference implementation is called Oni Apollo.[63]

Get Async JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.