@f/elapsed-time
v1.0.0
Published
Maintain a running counter of time elapsed from a certain point
Downloads
55,231
Readme
elapsed-time
Maintain a running counter of time elapsed from a certain point
Installation
$ npm install @f/elapsed-time
Usage
var elapsed = require('@f/elapsed-time')
var time = elapsed()
time() // ~0
setTimeout(function () {
time() // ~20
setTimeout(function () {
time() // ~50
}, 30)
}, 20)
API
elapsedTime(start)
start
- Optional starting point in milliseconds. If not passed, defaults to the current time.
Returns: A function that, when called, returns the elapsed time since start
.
License
MIT