O'Reilly logo

Mastering jQuery by Alex Libby

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

Introducing the requestAnimationFrame API

The shift to working online over the last few years has led to a massive increase in demand for performant browsers, while at the same time reducing resource consumption and battery power.

With this in mind, browser vendors and Microsoft teamed together to create three new APIs. We've already explored one, in the form of the Page Visibility API; the other that we're going to look at is requestAnimationFrame. All three (the third being setImmediate) were designed for better performance and increased power efficiency.

Exploring the concept

So, what is requestAnimationFrame? Simple – if you've spent any time creating animation using jQuery, you will no doubt have used the setInterval method (or even clearInterval ...

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