Acme.BookStore.HttpApi.Host/node_modules/sweetalert2/src/utils/Timer.js
(完整代码) 893Bexport default class Timer {
constructor (callback, delay) {
this.callback = callback
this.remaining = delay
this.running = false
this.start()
}
start () {
if (!this.running) {
this.running = true
this.started = new Date()
this.id = setTimeout(this.callback, this.remaining)
}
return this.remaining
}
stop () {
if (this.running) {
this.running = false
clearTimeout(this.id)
this.remaining -= new Date() - this.started
}
return this.remaining
}
increase (n) {
const running = this.running
if (running) {
this.stop()
}
this.remaining += n
if (running) {
this.start()
}
return this.remaining
}
getTimerLeft () {
if (this.running) {
this.stop()
this.start()
}
return this.remaining
}
isRunning () {
return this.running
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
