Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Apr 19, 2024 via pnpm

raf 3.4.1

requestAnimationFrame polyfill for node and the browser
Package summary
Share
0
issues
1
license
2
MIT
Package created
28 Dec 2012
Version published
2 Nov 2018
Maintainers
2
Total deps
2
Direct deps
1
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
2 Packages, Including:
performance-now@2.1.0
raf@3.4.1
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

1
All Dependencies CSV
β“˜ This is a list of raf 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
performance-now2.1.04.46 kBMIT
prod

Visualizations

Frequently Asked Questions

What does raf do?

raf, also known as requestAnimationFrame, is a polyfill for both node.js and the browser. It provides a simple and streamlined way to create smooth and efficient animations by telling the browser to execute specific coding instructions before the next repaint. This way, the browser can efficiently manage resources and provide a great user experience.

How do you use raf?

Using raf is pretty straightforward. It can be integrated with common module bundlers or directly included using a script tag. Here's how to use raf:

Firstly, install the raf package from npm:

npm install --save raf  

Then, require it like any other module:

const raf = require('raf')  

To create an animation loop, just call raf() with the desired function as a callback:

raf(function tick() {  
  // Animation logic goes here  
  raf(tick)  
})  

If you need to cancel the scheduled animation, simply use the cancel method and provide the identifier returned by raf():

var handle = raf(callback) // schedule the animation  
raf.cancel(handle) // cancels the scheduled animation  

You can also easily polyfill window.requestAnimationFrame and window.cancelAnimationFrame using the polyfill method:

raf.polyfill()

Where are the raf docs?

The raf package's documentation can be found at the Mozilla Developer Network and W3 Specification, using the following links:

For in-depth information and guidance, these resources provide comprehensive details about the requestAnimationFrame API.