mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
33 lines
595 B
TypeScript
33 lines
595 B
TypeScript
import { Timer, Stopwatch, Timespan, millisPerSecond } from 'sharp-timer';
|
|
|
|
const millisecondsPerSecond = millisPerSecond;
|
|
|
|
// timer test
|
|
let timer = new Timer(10);
|
|
timer.toString();
|
|
timer.onIntervalElapsing(i => { });
|
|
timer.onIntervalElapsed(() => {
|
|
timer.stop();
|
|
});
|
|
|
|
timer.start();
|
|
|
|
// stopwatch test
|
|
let stopwatch = Stopwatch.startNew();
|
|
|
|
const intervalId = setInterval(() => { }, 10);
|
|
|
|
setTimeout(() => {
|
|
clearInterval(intervalId);
|
|
stopwatch.dispose();
|
|
}, 100);
|
|
|
|
// timespan test
|
|
const {
|
|
days,
|
|
hours,
|
|
minutes,
|
|
seconds,
|
|
milliseconds
|
|
} = Timespan.fromDays(2);
|