Skip to content

Commit bcdedb3

Browse files
committed
Fixing incompability with zonejs 0.8.18
1 parent 861b6cd commit bcdedb3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Promise.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ export function newScope (fn, props, a1, a2) {
645645
var globalEnv = globalPSD.env;
646646
psd.env = patchGlobalPromise ? {
647647
Promise: Promise, // Changing window.Promise could be omitted for Chrome and Edge, where IDB+Promise plays well!
648+
PromiseProp: {value: Promise, configurable: true, writable: true},
648649
all: Promise.all,
649650
race: Promise.race,
650651
resolve: Promise.resolve,
@@ -744,7 +745,7 @@ function switchToZone (targetZone, bEnteringZone) {
744745
// Leaving or entering global zone. It's time to patch / restore global Promise.
745746

746747
// Set this Promise to window.Promise so that transiled async functions will work on Firefox, Safari and IE, as well as with Zonejs and angular.
747-
_global.Promise = targetEnv.Promise;
748+
Object.defineProperty(_global, 'Promise', targetEnv.PromiseProp);
748749

749750
// Support Promise.all() etc to work indexedDB-safe also when people are including es6-promise as a module (they might
750751
// not be accessing global.Promise but a local reference to it)
@@ -760,6 +761,7 @@ function snapShot () {
760761
var GlobalPromise = _global.Promise;
761762
return patchGlobalPromise ? {
762763
Promise: GlobalPromise,
764+
PromiseProp: Object.getOwnPropertyDescriptor(_global, "Promise"),
763765
all: GlobalPromise.all,
764766
race: GlobalPromise.race,
765767
resolve: GlobalPromise.resolve,

0 commit comments

Comments
 (0)