Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
fix(core): use then directly when promise is not patchable (#1079)
Browse files Browse the repository at this point in the history
  • Loading branch information
JiaLiPassion authored and mhevery committed Jun 18, 2018
1 parent 14cfc68 commit d7e0a31
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/zone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,13 @@ const Zone: ZoneType = (function(global: any) {
}
}
if (nativeMicroTaskQueuePromise) {
nativeMicroTaskQueuePromise[symbolThen](drainMicroTaskQueue);
let nativeThen = nativeMicroTaskQueuePromise[symbolThen];
if (!nativeThen) {
// native Promise is not patchable, we need to use `then` directly
// issue 1078
nativeThen = nativeMicroTaskQueuePromise['then'];
}
nativeThen.call(nativeMicroTaskQueuePromise, drainMicroTaskQueue);
} else {
global[symbolSetTimeout](drainMicroTaskQueue, 0);
}
Expand Down

0 comments on commit d7e0a31

Please sign in to comment.