From 99ede454479b2a947370afd957c71160f3e473d2 Mon Sep 17 00:00:00 2001 From: bekzod Date: Wed, 24 Jan 2018 17:51:57 +0500 Subject: [PATCH] remove redundant timer length check --- lib/index.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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() {