From a03b84bb090142751624938fae312748fcd056e6 Mon Sep 17 00:00:00 2001 From: qiyigg <30937518+qiyigg@users.noreply.github.com> Date: Thu, 17 Aug 2017 16:48:29 -0700 Subject: [PATCH] fix(task): fix closure compatibility issue with ZoneDelegate._updateTaskCount (#878) onHasTask wasn't getting triggerred for the Angular Zone for setTimeout when the application was closure compiled. This was causing errors with Protractor not being able to wait for a closure compiled application using setTimeout. --- lib/zone.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/zone.ts b/lib/zone.ts index bf4fd3480..66b898444 100644 --- a/lib/zone.ts +++ b/lib/zone.ts @@ -1123,16 +1123,16 @@ const Zone: ZoneType = (function(global: any) { _updateTaskCount(type: TaskType, count: number) { const counts = this._taskCounts; - const prev = (counts as any)[type]; - const next = (counts as any)[type] = prev + count; + const prev = counts[type]; + const next = counts[type] = prev + count; if (next < 0) { throw new Error('More tasks executed then were scheduled.'); } if (prev == 0 || next == 0) { const isEmpty: HasTaskState = { - microTask: counts.microTask > 0, - macroTask: counts.macroTask > 0, - eventTask: counts.eventTask > 0, + microTask: counts['microTask'] > 0, + macroTask: counts['macroTask'] > 0, + eventTask: counts['eventTask'] > 0, change: type }; this.hasTask(this.zone, isEmpty);