O'Reilly logo

Async JavaScript by Trevor Burnham

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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]

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required