# @mattdesl/raf

> requestAnimationFrame polyfill for node and the browser

Latest version **3.0.0** (published 2015-05-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @mattdesl/raf
pnpm add @mattdesl/raf
yarn add @mattdesl/raf
bun add @mattdesl/raf
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2015-05-09 |
| First published | 2015-05-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 735 |
| Author | Chris Dickinson |
| Maintainers | mattdesl |
| Keywords | requestAnimationFrame, polyfill |

## Links

- npm: https://www.npmjs.com/package/@mattdesl/raf
- Repository: https://github.com/chrisdickinson/raf
- Issues: https://github.com/chrisdickinson/raf/issues
- npm.io page: https://npm.io/package/@mattdesl/raf

## Dependencies (1)

- [performance-now](https://npm.io/package/performance-now.md) ~0.1.3

## Alternatives

- [@luma.gl/experimental](https://npm.io/package/@luma.gl/experimental.md) — 77.1K weekly downloads
- [persona-harness](https://npm.io/package/persona-harness.md) — 4.7K weekly downloads
- [@tsparticles/effect-bubble](https://npm.io/package/@tsparticles/effect-bubble.md) — 4.6K weekly downloads
- [f3d](https://npm.io/package/f3d.md) — 730 weekly downloads
- [spark-html-motion](https://npm.io/package/spark-html-motion.md) — 298 weekly downloads

## Recent versions

- 3.0.0 (latest) — 2015-05-09

## README

# @mattdesl/raf

A fork of [raf](https://github.com/chrisdickinson/raf) that improves the debugging experience, see [#26](https://github.com/chrisdickinson/raf/issues/26).

---

[![Browser Support](http://ci.testling.com/chrisdickinson/raf.png)](http://ci.testling.com/chrisdickinson/raf)

requestAnimationFrame polyfill for node and the browser.

Install:

```
npm install @mattdesl/raf --save
```


Use:

```js
var raf = require('raf')

raf(function tick() {
  // Animation logic
  raf(tick)
})
```

**Note:** The stream/event emitter logic found in versions prior to 1.0.0 can be found in [raf-stream](https://www.npmjs.org/package/raf-stream).



# API

[Documentation at Mozilla Developer Network](https://developer.mozilla.org/en-US/docs/Web/API/window.requestAnimationFrame), [W3 Specification](http://www.w3.org/TR/animation-timing/#requestAnimationFrame)

```js
var raf = require('raf')
```

## var handle = raf(callback)

`callback` is the function to invoke in the next frame. `handle` is a long integer value that uniquely identifies the entry in the callback list. This is a non-zero value, but you may not make any other assumptions about its value.

## raf.cancel(handle)

`handle` is the entry identifier returned by `raf()`. Removes the queued animation frame callback (other queued callbacks will still be invoked unless cancelled).

# Acknowledgments

Based on work by Erik Möller, Paul Irish, and Tino Zijdel (https://gist.github.com/paulirish/1579671)

# license

MIT

---
_Source: https://npm.io/package/@mattdesl/raf · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
