UNPKG

@discord-card/core

Version:
35 lines 964 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Timer = void 0; class Timer { constructor(name) { this.name = name; } start() { console.log(this.name, 'starting'); this.startTime = new Date(); this.lastTime = new Date(); return this; } step(name) { const diff = this.diff(); const whitespace = ''.padStart(4 - (diff + '').length); if (name) { console.log(whitespace, diff, 'ms', '-', name); } else { console.log(whitespace, diff, 'ms'); } this.lastTime = new Date(); return this; } stop() { const complete = new Date().getTime() - this.startTime.getTime(); console.log('Finished, took', ':', complete, 'ms'); } diff() { return new Date().getTime() - this.lastTime.getTime(); } } exports.Timer = Timer; //# sourceMappingURL=timer.js.map