zaraz

1.0.0 • Public • Published

NPM version Build Status Dependency Status

zaraz

Cheap way to introduce short async delay.

Install

$ npm install --save zaraz

Usage

const zaraz = require('zaraz');

function sum(a, b) {
  console.log(a + b);
}

zaraz(sum, 5, 7); // will display 13 after a short delay
zaraz(sum, 10, 10); // will displey 20 after it displays 13

API

zaraz(fn, ...args)

schedule fn to be called in near future - args will be passed to fn

zaraz.DELAY

minumum delay before task is processed - 10 millis by default

zaraz.ACTIVE

maximum time spent processing taks queue before yielding - 100 millis by default

zaraz.MAX_ITEMS

maximum number of task processed before yielding - 1000 by default

License

MIT © Damian Krzeminski

Readme

Keywords

Package Sidebar

Install

npm i zaraz

Weekly Downloads

5

Version

1.0.0

License

MIT

Unpacked Size

3.74 kB

Total Files

4

Last publish

Collaborators

  • pirxpilot