Yet another resumable timer
$ npm install timide
const {Timer} = require('timide');
const timer = new Timer({
// The initial state (default: `[false, 0, 0]`)
state: [false, 1598126121368, -20000],
});
timer.on('state', (value) => {
// Emitted when the state changes
});
// Starts the timer
timer.start();
// Stops the timer
timer.stop();
// Starts the timer including the missed time if stopped
timer.start(true);
// Updates the timer time
timer.seek(20000);
// Resets the timer
timer.reset();
See the declaration file.
Alexandre Breteau - @0xSeldszar
MIT © Alexandre Breteau