grindcode / tiny-pulsar

High performance scroll and resize events.

Home Page:https://www.npmjs.com/package/tiny-pulsar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tiny Pulsar

Build Status Dependency Status devDependency Status

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.

About

High performance scroll and resize events.

https://www.npmjs.com/package/tiny-pulsar

License:MIT License


Languages

Language:JavaScript 100.0%