���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/thietkeweb2/layout/default/node_modules/sweetalert2/src/utils/ |
export default class Timer { /** * @param {Function} callback * @param {number} delay */ constructor(callback, delay) { this.callback = callback this.remaining = delay this.running = false this.start() } /** * @returns {number} */ start() { if (!this.running) { this.running = true this.started = new Date() this.id = setTimeout(this.callback, this.remaining) } return this.remaining } /** * @returns {number} */ stop() { if (this.started && this.running) { this.running = false clearTimeout(this.id) this.remaining -= new Date().getTime() - this.started.getTime() } return this.remaining } /** * @param {number} n * @returns {number} */ increase(n) { const running = this.running if (running) { this.stop() } this.remaining += n if (running) { this.start() } return this.remaining } /** * @returns {number} */ getTimerLeft() { if (this.running) { this.stop() this.start() } return this.remaining } /** * @returns {boolean} */ isRunning() { return this.running } }