tranquil-tempest-timer
v0.1.5
Published
A utility library for enhanced timer management with pause, resume, and reset functionalities.
Downloads
1
Maintainers
Readme
Tranquil Tempest Timer
A utility library for enhanced timer management, offering functionalities to pause, resume, and reset timers with ease. Perfect for applications requiring precise timing control without the hassle.
Installation
npm install tranquil-tempest-timer
Usage
const TranquilTempestTimer = require('tranquil-tempest-timer');
const timer = new TranquilTempestTimer(5000); // 5 seconds timer
timer.on('start', () => console.log('Timer started'));
timer.on('pause', () => console.log('Timer paused'));
timer.on('resume', () => console.log('Timer resumed'));
timer.on('reset', () => console.log('Timer reset'));
timer.on('done', () => console.log('Timer completed'));
// Start the timer
timer.start();
// Pause the timer after 2 seconds
setTimeout(() => {
timer.pause();
}, 2000);
// Resume the timer after 4 seconds
setTimeout(() => {
timer.resume();
}, 4000);
API
start()
: Start or resume the timer.pause()
: Pause the timer.resume()
: Resume the timer if it was paused.reset()
: Reset the timer.
License
MIT