New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

cb-manager

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cb-manager

JavaScript callbacks, timeouts(setTimeout) and intervals(setInterval) manager

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

Callbacks, timeouts and intervals manager

clean up all callbacks, timeouts and intervals at once

Install

npm install cb-manager

Usage

var CbManager = require('cb-manager')

var cbm = CbManager()

var timeout = cbm.timeout(function(value) {
  console.log('timeout value = ' + value)
}, 1000, 'value')

// timeout 1000 ms with 2 repeats
var interval = cbm.interval(function(value) {
  console.log('interval value = ' + value)
}, 1000, 2, 'value')

// Also you can use equal simple alias cbm.cb(...)
var cb = cbm.callback(function(value) {
  console.log('callback value = ' + value)
})

cbm.clear(timeout) // clear the timeout
cbm.clear(interval) // clear the interval
cbm.clear(cb) // block callback execution
cb('value') // No reaction, because callback is blocked

cbm.clearAll() // clear all timeouts, intervals and block all callbacks created by this instance

//...

// Callback usage example

http.get(options, cmb.cb(function(res) {
  ...
}));

// block callback execution
cmb.clearAll();

Keywords

timeout

FAQs

Package last updated on 15 Jan 2016

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