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');
}