npm.io
2.4.8 • Published 7 years ago

@unsc/loop

Licence
MIT
Version
2.4.8
Deps
0
Size
8 kB
Vulns
0
Weekly
0
DeprecatedThis package is deprecated

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.