diff --git a/lib/index.ts b/lib/index.ts index 44940ac7..566d40dc 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -546,6 +546,7 @@ export default class Backburner { public cancel(timer?) { cancelCount++; + if (timer === null || timer === undefined) { return false; } let timerType = typeof timer; @@ -715,11 +716,9 @@ export default class Backburner { private _runExpiredTimers() { this._timerTimeoutId = null; - if (this._timers.length > 0) { - this.begin(); - this._scheduleExpiredTimers(); - this.end(); - } + this.begin(); + this._scheduleExpiredTimers(); + this.end(); } private _scheduleExpiredTimers() {