⛓⏲ fliptime
fluent timer with laps, microtime + parsing, multiple timers, (fallback to performance & Date), shorthand diffs & specifications
usage
yarn add fliptimenpm i fliptime --save
const timer =
uses microtime polyfill and if you install microtime it will require it when available (for node_gyp compat reasons) formatted with microseconds
simple
timerstart'canada'
laps
timerstart'canada'const lapper = timer
took
timerstart'canada'
multiple
const sleepfor = timerstart'eh'timerstart'canada' timertimertimer timer // second param is whether to use lapsconst lapTime = timer
formats
timerstart'eh'timer const microseconds = timerconst ms = timerconst parsed = timer
⚖️ tillNow
diff for each: milliseconds, seconds, minutes, hours, days, years.
const now = Dateconst ms s m h d y = timer // ms === 60000// s === 60// m === 1// h === 0// d === 0// y === 0
⚖️ tillNowSatisfies
check that the difference is equal or greater than
specification.
const then = Date // seconds, hours, minutes, days, years...// or shorthand: s, h, m, d, y//// true: >= 60 secondsconst satisfies = timer
🏊 additional
const now = timermicrotimeconst micro = timer timertimes = {}timerlaps = {}timerindex = 0
example
timertimesnamestarttimertimesnameendtimertimesnamediff