Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

electather/task-repeater

Open more actions menu

Repository files navigation

Task repeater

Version Documentation Maintenance License: MIT License: MIT

A tiny (657B Gzipped) micro library to manage repeated tasks with ease.

Install

yarn install

Usage

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 omid.ocean@gmail.com

Credits

this package is based on Repeatr library developed by @theshem.

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2021 Omid Astaraki omid.ocean@gmail.com.
This project is MIT licensed.

About

A Javascript library created to help manage repeated tasks

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.