Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/firstandthird/scroll-bus


https://github.com/firstandthird/scroll-bus

Last synced: 3 days ago
JSON representation

Awesome Lists containing this project

README

        

# Scroll Bus

[![Build Status](https://travis-ci.org/firstandthird/scroll-bus.svg?branch=master)](https://travis-ci.org/firstandthird/scroll-bus)
NPM version

Tiny library to centralize scroll handlers.

```javascript
import ScrollBus from 'scroll-bus';

ScrollBus.on(event => {
// Do stuff
});

// Debounced
ScrollBus.on(event => {
// Do stuff
}, 150);

// Debounced and immediate
ScrollBus.on(event => {
// Do stuff
}, 150, true);

// Removes handler
ScrollBus.off(handler);

// Removes all handlers
ScrollBus.off();
```