animation-frame-event-listener
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

animation-frame-event-listener

A util that uses window.requestAnimationFrame to better performance of scroll/resize event listeners.

usage

import {addAnimationFrameEventListener, removeAnimationFrameEventListener} from 'animation-frame-event-listener';

const exampleCallBack = () => {
  console.log(window.scrollY);
};

// addEvent
addAnimationFrameEventListener(window, 'scroll', 'anyUniqueIdForEvent', exampleCallBack);

// removeEvent
removeAnimationFrameEventListener(window, 'anyUniqueIdForEvent');

Readme

Keywords

none

Package Sidebar

Install

npm i animation-frame-event-listener

Weekly Downloads

4

Version

1.1.2

License

MIT

Unpacked Size

18.7 kB

Total Files

11

Last publish

Collaborators

  • ttt3pu