Skip to content

4.0.0

Compare
Choose a tag to compare
@alexreardon alexreardon released this 17 Jul 05:30
· 14 commits to master since this release

Changes

No longer returning AnimationFrame on WrappedFn calls #12

This is a breaking change 💥

Old

const wrapped = rafSchd(console.log);
const frameId: AnimationFrameId = wrapped('hi');

// and you could do this:
cancelAnimationFrame(frameId);

// or you could have done this
wrapped.cancel();

New

const wrapped = rafSchd(console.log);
wrapped('hi'); // returns undefined

// now the only way to cancel the scheduled frame
wrapped.cancel();

This change brings this library in line with other rate limiting functions out there. The fact that it uses an animation frame internally is an implementation detail and does not need to leak out to the consumer. Rather than having two ways of cancelling a frame, we now just have one.

- type WrapperFn = (...args: any[]) => AnimationFrameID;
+ type WrapperFn = (...args: mixed[]) => void;

Engineering health

  • moved from eslint to prettier #12