Skip to content

paldepind/fake-raf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fake-raf

A fake requestAnimationFrame, i.e. a stub for unit testing.

  • Very simple
  • Supports TypeScript

Usage

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`

About

A fake requestAnimationFrame perfect for unit testing.

Resources

License

Stars

Watchers

Forks

Packages

No packages published