https://github.com/electather/task-repeater
A Javascript library created to help manage repeated tasks
https://github.com/electather/task-repeater
repeat repetitive repetitive-tasks timed timeout timer
Last synced: 16 days ago
JSON representation
A Javascript library created to help manage repeated tasks
- Host: GitHub
- URL: https://github.com/electather/task-repeater
- Owner: electather
- License: mit
- Created: 2021-08-26T11:32:52.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-08-29T09:31:59.000Z (over 4 years ago)
- Last Synced: 2025-09-21T16:56:35.375Z (6 months ago)
- Topics: repeat, repetitive, repetitive-tasks, timed, timeout, timer
- Language: TypeScript
- Homepage:
- Size: 99.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Task repeater
A tiny [(657B Gzipped)](https://bundlephobia.com/package/task-repeater) micro library to manage repeated tasks with ease.
## Install
```sh
yarn install
```
## Usage
```typescript
import TaskRepeater from 'task-repeater';
const job1 = TaskRepeater()
.do(() => { /*...*/ })
.every(1000)
.start();
const job2 = TaskRepeater()
.do((itteration) => console.log(`itteration No.${itteration} ...`))
.do(() => { /*...*/ })
.finally((itterationsDone) => console.log(`tasks done. ${itterationsDone} itterations were completed.`))
.for(5) // times
.every(2_000) // interval in miliseconds
.delay(1_000) // initial delay in miliseconds
.start();
job1.stop(); // stops the repetitive calls
job1.reset(); // resets the counter as if it isn't invoked
```
## Author
👤 **Omid Astaraki **
* Github: [@electather](https://github.com/electather)
* LinkedIn: [@omid-astaraki](https://linkedin.com/in/omid-astaraki)
## Credits
this package is based on [Repeatr](https://github.com/theshem/Repeatr) library developed by [@theshem](https://github.com/theshem).
## 🤝 Contributing
Contributions, issues and feature requests are welcome!
Feel free to check [issues page](https://github.com/electather/task-repeater/issues). You can also take a look at the [contributing guide](https://github.com/electather/task-repeater/blob/master/CONTRIBUTING.md).
## Show your support
Give a ⭐️ if this project helped you!
## 📝 License
Copyright © 2021 [Omid Astaraki ](https://github.com/electather).
This project is [MIT](https://github.com/electather/task-repeater/blob/master/LICENSE) licensed.