Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

with-raf

flekschas19MIT1.1.1

requestAnimationFrame-based throttling

request animation frame, raf, throttle, throttling, higher order function

readme

Higher Order Function for requestAnimationFrame Throttling

Build Status

A simple higher order function to throttle a function by animation frames.

Install

npm -i -D with-raf

API

withRaf(fn, onCall, raf = window.requestAnimationFrame)

Returns: the animation frame-throttled version of fn.

changelog

v1.1.1

  • Switched the execution order of unsetting isRequesting and triggering onCall to be able to easily create an animation-frame loop using withRaf.

v1.1.0

  • Fixed a bug that prevented continuous requests from accumulating
  • Use the last argument instead of the first when calling the throttled function

v1.0.0

  • Initial version