# reraf

> A super light and simple way to reschedule animation frames

Latest version **1.1.1** (published 2019-11-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install reraf
pnpm add reraf
yarn add reraf
bun add reraf
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2019-11-05 |
| First published | 2019-10-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Andrea Giammarchi |
| Maintainers | webreflection |
| Keywords | requestAnimationFrame, schedule, cancel |

## Links

- npm: https://www.npmjs.com/package/reraf
- npm.io page: https://npm.io/package/reraf

## 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

- 1.1.1 (latest) — 2019-11-05
- 1.1.0 — 2019-11-05
- 1.0.0 — 2019-11-05
- 0.2.2 — 2019-10-28
- 0.2.1 — 2019-10-28
- 0.2.0 — 2019-10-28
- 0.1.2 — 2019-10-28
- 0.1.1 — 2019-10-27
- 0.1.0 — 2019-10-27
- 0.0.0 — 2019-10-27

## README

# reraf

[![Build Status](https://travis-ci.com/WebReflection/reraf.svg?branch=master)](https://travis-ci.com/WebReflection/reraf) [![Coverage Status](https://coveralls.io/repos/github/WebReflection/reraf/badge.svg?branch=master)](https://coveralls.io/github/WebReflection/reraf?branch=master)

<sup>**Social Media Photo by [Hans Eiskonen](https://unsplash.com/@eiskonen) on [Unsplash](https://unsplash.com/)**</sup>

A super light and simple way to reschedule animation frames, compatible with every browser and Node.js through a `setTimeout` and `clearTimeout` fallback.

```js
import reraf from 'reraf';
// or const reraf = require('reraf');
// or <script src="//unpkg.com/reraf">

const reschedule = reraf(/* optional integer limit */);

reschedule(console.log, null, ['first']);
reschedule(console.log, null, ['second']);
// will log "second", but never "first"
```

The `reschedule(...)` returns a function to be able to `stop()` the scheduled animation frame, in case it's needed.

If a `truthy` value is passed to `stop(truthy)`, the callback will be "flushed" (invoked) if it didn't flush already.

The `stop(...)` function returns a boolean value, indicating the stop actually stopped the execution of the callback, or it didn't, 'cause it happened before.

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