@deepkit/core
Version:
Deepkit core library
33 lines • 1.01 kB
JavaScript
;
/*
* Deepkit Framework
* Copyright (C) 2021 Deepkit UG, Marc J. Schmidt
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the MIT License.
*
* You should have received a copy of the MIT License along with this program.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.Timer = void 0;
class Timer {
constructor() {
this.timeoutTimers = []; //any necessary to be compatible with NodeJS/Browser env
}
setTimeout(cb, timeout) {
const timer = setTimeout(cb, timeout);
this.timeoutTimers.push(timer);
return timer;
}
/**
* Clears all timers at once.
*/
clear() {
for (const timeout of this.timeoutTimers) {
clearTimeout(timeout);
}
}
}
exports.Timer = Timer;
Timer.__type = ['timeoutTimers', function () { return []; }, '', 'cb', 'timeout', 'setTimeout', 'clear', '"F3!<>"PP$/#2$\'2%"0&P"0\'5'];
//# sourceMappingURL=timer.js.map