tmg
Timer generator
tmg-cli - CLI for this module
Install
npm install --save tmg
Usage
var tmg = ;var date = 2018 05 01 12 0 0; start { t; };
API
tmg([date])
Return timer, default new Date()
var timer = ;var countdown = ;
.format(str)
Set format string
; // 4 days 2:00:15
Can be used:
D
- daysh
,hh
- hoursm
,mm
- minutess
,ss
- seconds[escaped]
- escaped text
.start(fn)
Start timer interval
timerstart { t; // '12:00:10'};
.end()
Clear timer interval
.toObject([str])
Return object with current timer value with local format str
timer; // {h: 12, m: 0, s: 10}timer; // {m: 720, s: 10}
.toArray([str])
Return object with current timer value with local format str
timer; // [12, 0, 10]timer; // [720, 10]
.toString([str])
Return string with current timer value with local format str
timer; // '12:00:10'timer; // '720:10'
License
MIT