tiny-pulsar
v1.0.1
Published
Minimal footprint library that triggers a callback when the user scrolls or resizes the browser.
Downloads
17
Maintainers
Readme
Tiny Pulsar
Minimal footprint library that triggers a callback when the user scrolls or resizes the browser.
Get Started
npm install tiny-pulsar
API
register(namespace, callback)
Register a callback to be fired. Registration is accumulative and namespace is not unique.
namespace
: Callback namespace. (String)callback
: Function to be fired. (Function)
deregister(namespace)
Deregister all callbacks registered with the same namespace.
namespace
: Callback namespace. (String)
Usage
import { register, deregister } from 'tiny-pulsar'
register('this is a namespace', function () {
// → your code goes here
deregister('this is a namespace')
})
License
See the License file.