npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

ember-run-raf

v1.1.3

Published

Use requestAnimationFrame with Backburner.

Downloads

132

Readme

Ember-run-raf

npm version Build Status Ember Observer Score

Ember-run-raf is a requestAnimationFrame polyfill and a suite of raf tools to complement, good all the way back to IE9 (potentially IE8).

This addon overwrites setTimeout to utilize raf whenever the given wait is null or 0, this has the effect of making backburner utilize raf to flush queues, which is advantageous when your app performs a lot of animation, scrolling, or complex DOM insertions.

This project grew out of smoke-and-mirrors, where these tools were used to reduce scroll jank and ensure that DOM and scroll position manipulation would occur during the same animation frame.

What are the consequences?

requestAnimationFrame is basically a much better setTimeout with a few useful additional behaviors. It's ties to the platform's refresh rate and will execute the given work during the next refresh. Additionally, any work scheduled into it becomes non-DOM affecting until all scheduled work completes.

What that means is one function can manipulate style of content on something, the next function can accurately read that new style or content, but the browser doesn't actually render it until the end.

Some side effect include:

  • the browser auto slows or pauses frames when the tab or window is hidden to preserve memory
  • it has the effect of coalescing run loops that would trigger close together if you make Ember.run use it
  • it reduces scroll and animation jank by ensuring that you aren't flooding your code with callbacks faster than the browser can handle them
  • it lets you add content to the DOM, shift the scroll position, and alter that content all without producing a visible change on screen

For callbacks while scrolling, using run.scheduleOnce + requestAnimationFrame has turned out to be a hugely better throttle mechanism than run.throttle. Not only does it perfectly limit the amount of work to be done to the available time to do it, but it additionally ensures that the work is correctly scheduled into the queue at the right time (you would have needed to schedule from within the throttle callback before).

Instead of guessing how often you should execute and spending a ton of time in backburner to do so, your method executes exactly when it next should, in the order it should.

This addon is mostly to start a conversation and to provide the ability to test out the idea and use it in ember applications today. Ideally, a tighter more direct integration with backburner will be possible soon, without overriding setTimeout globally.

The Polyfill

The specific polyfill in use here could probably be improved, I'm leaning towards creating a new polyfill of my own after browsing the available options on npm, but recommendations are welcome.