New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

scroll-resize

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scroll-resize

Throttled window scroll and resize events

latest
Source
npmnpm
Version
0.3.1
Version published
Maintainers
1
Created
Source

scroll-resize

Throttled window scroll and resize events

Install

npm i scroll-resize

Package on npm

API

constructor(cb, [opts])

ArgumentAction
cbthe callback
opts.delayoptional delay, default to 50 ms, min to 25 ms
opts.ignoreoptional ignore, accept scroll or resize, default to undefined
opts.silentif true, no data will be computed and sent to the callback, default to false

The callback cb receive an object with 6 properties — can disabled with opts.silent

ArgumentAction
widththe window innerWidth
heightthe window innerHeight
leftthe window scrollX
topthe window scrollY
rightthe window scrollX + window.innerWidth
bottomthe window scrollY + window.innerHeight
const SR = require('scroll-resize')

function update(data) {
  // {with:.., height:.., left:.., top:.., right:.., bottom:..}
  console.log(data)
}

var sr = new SR(update)

sr.start()

immediate()

Invoke the callbak function cb immediately, cancel the internal throttling if running

Can be used even if the instance was not started yet or is already stopped

start([skip])

Start listening the scroll and|or resize events

By default, the callback fonction cb is called right after the start method is invoked

Set skip to true if you want instead wait the first real event

stop([skip])

Stop listening the events, cancel the internal throttling

By default, the callback fonction cb is called when the stop method is invoked

Set skip to true if you don't want this safer last call

License

MIT

Keywords

throttle

FAQs

Package last updated on 19 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts