Socket
Book a DemoInstallSign in
Socket

debounce-events

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

debounce-events

Global events debounce using redis

latest
Source
npmnpm
Version
0.0.2
Version published
Maintainers
1
Created
Source

debounce-events NPM version Build Status

Global events debounce using redis

Installation

$ npm install --save debounce-events

Usage

Example 1:

var Channel = require('debounce-events');
var ch = new Channel(function update() {
  // do something...
});
ch.emit('update');
ch.emit('update');
ch.emit('update');
ch.emit('update'); // only update once

Example 2:

var Redis = require('ioredis');
var Channel = require('debounce-events');
var ch = new Channel(function update() {
  // do something
}, {
  wait: 50,
  adapter: Channel.ADAPTER_REDIS,
  redisClient: new Redis()
});

ch.emit('update1'); // emit update1 
ch.emit('update1'); // same event will only emit once
ch.emit('update2'); // emit other event: update2

License

MIT © Gaara

Keywords

debounce

FAQs

Package last updated on 21 Jan 2018

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