Getting Started - gaskam/dev-timer GitHub Wiki
Dev Timer is a very simple library to help you implement timings in your code. It's designed to stay precise over time.
Features
- 𤊠Extremely easy to use, even for beginners
- đĒļ The zipped package is really lightweight
- âī¸ Unless native JavaScript methods, it doesn't drift over time
- đĨŗ 100% JS / TS
- đ¤ Minified ( soon )
Usage
You can find the documentation here. To find more examples, please refer to examples folder or step by step examples.
Basic Example :
const { Timer } = require('dev-timer');
// Create a new timer instance with a 15 seconds duration
const timer = new Timer(15000);
timer.start(); // Start the timer
// Add a callback to be called when the timer ends
timer.onEnd = ()=>{
console.log('Timer ended');
}