npm.io
3.2.1 • Published 6 years ago

srraf

Licence
MIT
Version
3.2.1
Deps
0
Size
9 kB
Vulns
0
Weekly
0
Stars
29

srraf

Monitor scrolling and resizing without event listeners. 300 bytes gzipped.

Install

npm i srraf --save

Usage

import srraf from 'srraf'

const scroller = srraf(({ x, px, y, py, vh, pvh, vw, pvw }, timestamp) => {
  // ...
})

scroller.update() // check position
scroller.destroy() // destroy listener

Note: values prefixed with p denote previous values.

License

MIT License Eric Bailey