New: Introducing PHP and Composer Support.Read the Announcement
Socket
Book a DemoInstallSign in
Socket

debarrel

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

debarrel

A library for NodeJS that allows you to accumulate a load of changes, then run a function after a set amount of time with those changes.

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

debarrel

GitHub code size in bytes GitHub package.json version GitHub js-semistandard-style

A library for NodeJS that allows you to accumulate a load of changes, then run a function after a set amount of time with those changes.

Installation

npm install --save debarrel

Usage

The debarrel module returns an function that can be called to mutate the cache.

Example

const debarrel = require('debarrel');

let total = 0;
const watch = debarrel(function () {
  console.log('total:', total);
}, {
  minimumFlushTime: 100,
  maximumFlushTime: 2000
})

const increment = watch(function (increment) {
  total = total + increment;
})

// call increment. debarrel will flush every 10
const interval = setInterval(function () {
  increment(1)
}, 10);

// stop after 20 increments
setTimeout(() => {
  clearInterval(interval)
, 200);

FAQs

Package last updated on 03 Jun 2021

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