Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/paldepind/fake-raf
A fake requestAnimationFrame perfect for unit testing.
https://github.com/paldepind/fake-raf
Last synced: 15 days ago
JSON representation
A fake requestAnimationFrame perfect for unit testing.
- Host: GitHub
- URL: https://github.com/paldepind/fake-raf
- Owner: paldepind
- License: mit
- Created: 2015-03-28T18:24:45.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-09T17:18:48.000Z (over 7 years ago)
- Last Synced: 2024-08-09T21:46:18.044Z (3 months ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fake-raf
A fake `requestAnimationFrame`, i.e. a stub for unit testing.
* Very simple
* Supports TypeScript## Usage
```js
import * as fakeRaf from "fake-raf";fakeRaf.use(); // install global mock
function loop() {
// do stuff here
requestAnimationFrame(loop);
}
requestAnimationFrame(loop);fakeRaf.step(); // call all listeners
fakeRaf.step();
fakeRaf.step();fakeRaf.restore(); // restore the real `requestAnimationFrame`
```