DefinitelyTyped/types/tocktimer/tocktimer-tests.ts
Evan Shortiss dbb5456b01 Add "tocktimer" typings (#20017)
* add types for tocktimer

* use correct formatting

* add linting and update structure

* update for build issues
2017-09-26 14:07:01 +09:00

29 lines
485 B
TypeScript

import * as tock from 'tocktimer';
let timer: tock.Tock;
let opts: tock.TockOptions;
// Opts that conform to spec
opts = {
interval: 100,
countdown: true,
callback: () => {
// Tick tock...clock is ticking
},
complete: () => {
// Ding ding...time's up
}
};
// Create a tock instance
timer = tock();
timer.lap();
timer.msToTime(Date.now());
timer.msToTimecode(Date.now());
timer.pause();
timer.reset();
timer.stop();
timer.timeToMS('12:51');