rx-wheel

0.1.0 • Public • Published

rx-wheel

A small higher-order function returning an RxJS Observable that emits at the start of a wheel event and try to deal with OSX inertia

Usage

npm i rxjs rx-wheel --save
import rxWheel from 'rx-wheel';

rxWheel({ treshold, throttleTime }).subscribe(val => {    
    console.log(val.direction); // "down" or "up" 
    $('body')
        .animate({
            scrollTop: (val.direction === 'up' ? '-=' : '+=') + $(window).height()
        }, {
            duration: 500,
            easing: 'easeOutQuart'
        });
});

Parameters

  • treshold: energy treshold to emit (default to 10)
  • throttleTime: throttle time (default to 150 ms)

Development

npm run build:local

Build

npm run build:prod

Dependents (0)

Package Sidebar

Install

npm i rx-wheel

Weekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • seracio