feat(zone): upgrade to zone.js@0.6.21

This commit is contained in:
Misko Hevery 2016-09-10 09:16:03 -07:00 committed by Igor Minar
parent c9513b713a
commit 051a6ebe12
6 changed files with 60 additions and 62 deletions

View File

@ -9,7 +9,7 @@
"license": "MIT", "license": "MIT",
"peerDependencies": { "peerDependencies": {
"rxjs": "5.0.0-beta.11", "rxjs": "5.0.0-beta.11",
"zone.js": "^0.6.17" "zone.js": "^0.6.21"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -35,62 +35,61 @@ export class NgZoneImpl {
this.setMacrotask = setMacrotask; this.setMacrotask = setMacrotask;
this.onError = onError; this.onError = onError;
if (Zone) { if (typeof Zone == 'undefined') {
this.outer = this.inner = Zone.current; throw new Error('Angular requires Zone.js prolyfill.');
if ((Zone as any /** TODO #9100 */)['wtfZoneSpec']) {
this.inner = this.inner.fork((Zone as any /** TODO #9100 */)['wtfZoneSpec']);
}
if (trace && (Zone as any /** TODO #9100 */)['longStackTraceZoneSpec']) {
this.inner = this.inner.fork((Zone as any /** TODO #9100 */)['longStackTraceZoneSpec']);
}
this.inner = this.inner.fork({
name: 'angular',
properties: <any>{'isAngularZone': true},
onInvokeTask: (delegate: ZoneDelegate, current: Zone, target: Zone, task: Task,
applyThis: any, applyArgs: any): any => {
try {
this.onEnter();
return delegate.invokeTask(target, task, applyThis, applyArgs);
} finally {
this.onLeave();
}
},
onInvoke: (delegate: ZoneDelegate, current: Zone, target: Zone, callback: Function,
applyThis: any, applyArgs: any[], source: string): any => {
try {
this.onEnter();
return delegate.invoke(target, callback, applyThis, applyArgs, source);
} finally {
this.onLeave();
}
},
onHasTask:
(delegate: ZoneDelegate, current: Zone, target: Zone, hasTaskState: HasTaskState) => {
delegate.hasTask(target, hasTaskState);
if (current == target) {
// We are only interested in hasTask events which originate from our zone
// (A child hasTask event is not interesting to us)
if (hasTaskState.change == 'microTask') {
this.setMicrotask(hasTaskState.microTask);
} else if (hasTaskState.change == 'macroTask') {
this.setMacrotask(hasTaskState.macroTask);
}
}
},
onHandleError: (delegate: ZoneDelegate, current: Zone, target: Zone, error: any):
boolean => {
delegate.handleError(target, error);
this.onError(error);
return false;
}
});
} else {
throw new Error('Angular requires Zone.js polyfill.');
} }
Zone.assertZonePatched();
this.outer = this.inner = Zone.current;
if ((Zone as any)['wtfZoneSpec']) {
this.inner = this.inner.fork((Zone as any)['wtfZoneSpec']);
}
if (trace && (Zone as any)['longStackTraceZoneSpec']) {
this.inner = this.inner.fork((Zone as any)['longStackTraceZoneSpec']);
}
this.inner = this.inner.fork({
name: 'angular',
properties: <any>{'isAngularZone': true},
onInvokeTask: (delegate: ZoneDelegate, current: Zone, target: Zone, task: Task,
applyThis: any, applyArgs: any): any => {
try {
this.onEnter();
return delegate.invokeTask(target, task, applyThis, applyArgs);
} finally {
this.onLeave();
}
},
onInvoke: (delegate: ZoneDelegate, current: Zone, target: Zone, callback: Function,
applyThis: any, applyArgs: any[], source: string): any => {
try {
this.onEnter();
return delegate.invoke(target, callback, applyThis, applyArgs, source);
} finally {
this.onLeave();
}
},
onHasTask:
(delegate: ZoneDelegate, current: Zone, target: Zone, hasTaskState: HasTaskState) => {
delegate.hasTask(target, hasTaskState);
if (current === target) {
// We are only interested in hasTask events which originate from our zone
// (A child hasTask event is not interesting to us)
if (hasTaskState.change == 'microTask') {
this.setMicrotask(hasTaskState.microTask);
} else if (hasTaskState.change == 'macroTask') {
this.setMacrotask(hasTaskState.macroTask);
}
}
},
onHandleError: (delegate: ZoneDelegate, current: Zone, target: Zone, error: any): boolean => {
delegate.handleError(target, error);
this.onError(error);
return false;
}
});
} }
runInner(fn: () => any): any { return this.inner.run(fn); }; runInner(fn: () => any): any { return this.inner.run(fn); };

View File

@ -4655,7 +4655,7 @@
} }
}, },
"zone.js": { "zone.js": {
"version": "0.6.17" "version": "0.6.21"
} }
}, },
"name": "angular-srcs", "name": "angular-srcs",

5
npm-shrinkwrap.json generated
View File

@ -7421,9 +7421,8 @@
} }
}, },
"zone.js": { "zone.js": {
"version": "0.6.17", "version": "0.6.21",
"from": "zone.js@0.6.17", "from": "zone.js@0.6.21"
"resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.6.17.tgz"
} }
} }
} }

View File

@ -21,7 +21,7 @@
"core-js": "^2.4.1", "core-js": "^2.4.1",
"reflect-metadata": "^0.1.3", "reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.11", "rxjs": "5.0.0-beta.11",
"zone.js": "^0.6.17" "zone.js": "^0.6.21"
}, },
"devDependencies": { "devDependencies": {
"@types/angularjs": "^1.5.13-alpha", "@types/angularjs": "^1.5.13-alpha",

View File

@ -9,7 +9,7 @@ LINKABLE_PKGS=(
PKGS=( PKGS=(
reflect-metadata@0.1.8 reflect-metadata@0.1.8
typescript@2.0.2 typescript@2.0.2
zone.js@0.6.17 zone.js@0.6.21
rxjs@5.0.0-beta.11 rxjs@5.0.0-beta.11
@types/{node@6.0.38,jasmine@2.2.33} @types/{node@6.0.38,jasmine@2.2.33}
jasmine@2.4.1 jasmine@2.4.1