2.0.4 • Published 3 years ago
repeat v2.0.4
repeat
create repeating task chains
Contents
Features
- Chain any number of tasks and repeat them once or forever.
- Optional synchronous and asynchronous API.
Install
From NPM:
> npm i repeat
Chain
Creating a new chain
The following chain will execute all tasks every second. A task is any callable function.
// ES6
import { Chain } from 'repeat'
// ES5
// let { Chain } = require('repeat')
let chain = new Chain()
chain
.add(
// task A
() => console.log('how are you?'),
// task B
() => console.log('good')
// you can add task C, D, E, F ...
)
.every(1000)
Examples
The following methods are available on the chain.
add
// add any number of tasks to the chain
chain.add(
() => console.log('cat'),
() => console.log('dog'),
() => console.log('fish')
)
once
// execute the tasks once
chain.once()
every
// execute the tasks asynchronously every second
chain.every(1000)
forever
// execute the tasks as fast as possible
chain.forever()
cancel
// halt further execution of tasks
chain.cancel()
Contributing
Pull requests are encouraged. 😁
2.0.4
3 years ago
2.0.3
3 years ago
2.0.2
3 years ago
2.0.1
3 years ago
2.0.0
3 years ago
1.2.0
5 years ago
1.1.4
5 years ago
1.1.3
5 years ago
1.1.2
5 years ago
1.1.1
5 years ago
1.1.0
5 years ago
1.0.3
5 years ago
1.0.2
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago
0.0.6
11 years ago
0.0.5
11 years ago
0.0.4
12 years ago
0.0.3
12 years ago
0.0.2
12 years ago
0.0.1
12 years ago