BonsaiDen / JavaScript-Garden

A collection of documentation about the most quirky parts of the JavaScript language.
http://bonsaiden.github.com/JavaScript-Garden
MIT License
3.45k stars 558 forks source link

footnote for requestAnimationFrame and setImmediate #346

Closed lewisje closed 8 years ago

lewisje commented 8 years ago

Their purpose is similar to setTimeout (with timeouts of 16 and 0, respectively), but as far as I can see, they lack the major issue of setTimeout, because they do not accept strings of code.

requestAnimationFrame is implemented in modern browsers, and although setImmediate is only implemented in IE10+, Edge, and Node, and faces resistance from Gecko, WebKit, and Blink, it's still useful enough for a polyfill to be developed for it.

peterjwest commented 8 years ago

Javascript Garden only covers ES5. I think it would be great to extend this to ES6, but this would take a lot of work.

lewisje commented 8 years ago

Those aren't even ES5 vs. ES6 things, but I will admit that browsers from when ES5 was ratified probably don't have either thing.

Specifically, requestAnimationFrame was originally in the W3C Animation Timing Specification, but it was moved to HTML 5.1 when that spec was deprecated; setImmediate was proposed to the W3C by Microsoft in 2011 but so far only adopted by Microsoft and Node and polyfilled fairly well for other modern browsers.

I'll close it anyway, because even mentioning these two things may complicate matters.