Timer
Simple timer utility to start, stop, check duration, and clear a timer. Works in Node, JS/UMD modules, or the browser.
Install
npm install @brikcss/timer --save-dev
Usage
timer.start(id)
Start a new or existing timer. Creates one if it doesn't exist. Returns the newly created timer object.
timer.stop(id)
Stop an existing timer. Returns the timer's duration as a string.
timer.duration(id)
Get the duration of a timer. Returns a string in ms
or s
.
timer.clear(id)
Clear / remove a timer from memory.
Environment support
Node | CLI | UMD | ES Module | Browser |
---|---|---|---|---|
x |