4.0.0
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
toprettier
#12