2.4.8 • Published 5 years ago
@unsc/loop v2.4.8
loop
install
npm install --save @unsc/loop
usage
The following loop will run all tasks once, in place.
import loop from "@unsc/loop";
loop()
.do(() => console.log("how are you?"))
.do(() => console.log("good"))
.once();
methods
These methods are available to Loop objects.
Method | Description |
---|---|
once(?async) | Perform the loop once. |
forever(?async) | Perform the loop infinitely. |
cancel() | Cancel a forever loop. |
async or sync
By default all loops are synchronous, however it is easy to change that.
Simply pass a boolean to the .once
or .forever
methods, for an asynchronous loop use true
.
contribute
Pull requests are encouraged.