3.0.1 • Published 7 years ago

distribute-js v3.0.1

Weekly downloads
1
License
GPL-2.0
Repository
github
Last release
7 years ago

DistributeJs

Distribute anonymous function executions over a defined timespan

Build Status Dependency Status

Install

$ npm i -S distribute-js

Usage

const Distribution = require('distribute-js');
const collection = new Distribution();

collection.add(() => {
	console.log(1);
});

collection.add(() => {
	console.log(2);
});

const promise = distribution.in(2000).run();
promise.resolve((distribution) => {
	console.log(distribution);
});

API

Methods

add(callable)

Method to add a new function to the stack.

Arguments
ArgumentTypeDescription
callableFunctionFunction to be added to the execution stack.

in(timespan)

Method to set the timespan in which all functions should be executed.

Arguments
ArgumentTypeDescription
timespanNumberTimespan in milliseconds.

run()

Method to execute the call stack. Returns a Promise.

License

GPL-2.0 © Willi Eßer

3.0.1

7 years ago

3.0.0

7 years ago

2.0.3

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago