0.1.1 • Published 6 years ago
timmerman v0.1.1
timmerman
An accurate countdown timer that works with event emitters.
Usage
Installation
$ npm install timmerman
Usage
Import timmerman into your project.
import Timmerman from "timmerman";Use it by creating an instance and passing a timer duration in milliseconds. It will tick every 10ms by default.
From there, you can have the timer start, skip, stop or wait.
const timer = new Timmerman(3000, 100); // Tick every 100ms until 3000ms
timer.start(); // Start counting down
timer.pause(); // Pause counting
timer.skip(500); // Skip 500ms
timer.resume(); // Resume counting down
timer.stop(); // Stop counting down and reset to the duration.Timmerman is an event emitter itself and you can use the on and off functions to listen for the timer's states.
const timer = new Timmerman(3000);
timer.start();
timer.on("initialize", () => {});
timer.on("start", currentTime => {});
timer.on("tick", currentTime => {});
timer.on("pause", currentTime => {});
timer.on("skip", (currentTime, skipTime) => {});
timer.on("stop", currentTime => {});
timer.on("end", currentTime => {});Contributing
Want to contribute? Great! Please branch out from the master version from using a branchname such as feature/{insert-descriptive-feature-name} and create a pull request when ready.
Use npm run build to build the project.