
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
request-frame
Advanced tools
requestAnimationFrame & cancelAnimationFrame polyfill for optimal cross-browser development.
npm i request-frame --save
| bower i request-frame
| src | release
import requestFrame from 'request-frame'; // ES6
<script src="request-frame.js"></script> // AMD, IIFE
const requestFrame = require('request-frame'); // CJS
requestFrame( request | cancel | native ) request is default.
var request = requestFrame('request'); // window.requestAnimationFrame | setTimeout
var cancel = requestFrame('cancel'); // window.cancelAnimationFrame | cancelTimeout
requestFrame('native'); // re/ declares requestAnimationFrame & cancelAnimationFrame
Below is just an example of the requestAnimationFrame API, see links: MDN, MSDN & W3.
var requestId;
function something( useTimeStamp ){
// Do something here
requestId = request(something);
}
requestId = request(something); // Assigns Id & calls "something"
cancel(requestId); // Cancels frame request
request-frame aims to provide an optimal development consistency with the use of animation timing functions across the large number of browsers and devices. This lib is ideal for those who may want to avoid re-assigning native functions, or avoid interfering with other libs that do. requestFrame() is purposely not a constructor. The intention is for requestAnimationFrame to be used once or few times during execution since multiple task are expected to be more efficient via a single requestAnimationFrame loop compared to several instances.
Supports everything from IE5+
Just do it!
npm run test
To launch port 9999
Browser based testing for RAF is imperative
Created by Julien Etienne, timestamp by Erik Möller, Paul Irish & Darius Bacon.
© 2016 Julien Etienne
FAQs
requestAnimationFrame & cancelAnimationFrame polyfill for optimal cross-browser development.
The npm package request-frame receives a total of 663 weekly downloads. As such, request-frame popularity was classified as not popular.
We found that request-frame demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.