chore: upgrade to new Zone.js API v0.6.2

BREAKING CHANGE

Removed deprecated API from NgZone
- `NgZone.overrideOnTurnStart`
- `NgZone.overrideOnTurnDone`
- `NgZone.overrideOnEventDone`
- `NgZone.overrideOnErrorHandler`

Rename NgZone API
- `NgZone.onTurnStart` => `NgZone.onUnstable`
- `NgZone.onTurnDone` => `NgZone.onMicrotaskEmpty`
- `NgZone.onEventDone` => `NgZone.onStable`

Closes #7345
This commit is contained in:
Misko Hevery
2016-02-25 14:24:17 -08:00
committed by Miško Hevery
parent f9fb72fb0e
commit 310620fd12
42 changed files with 866 additions and 1826 deletions

View File

@ -1,4 +1,4 @@
import {NgZone} from 'angular2/src/core/zone/ng_zone';
import {NgZone, NgZoneError} from 'angular2/src/core/zone/ng_zone';
import {
Type,
isBlank,
@ -254,7 +254,9 @@ export class PlatformRef_ extends PlatformRef {
try {
injector = this.injector.resolveAndCreateChild(providers);
exceptionHandler = injector.get(ExceptionHandler);
zone.overrideOnErrorHandler((e, s) => exceptionHandler.call(e, s));
ObservableWrapper.subscribe(zone.onError, (error: NgZoneError) => {
exceptionHandler.call(error.error, error.stackTrace);
});
} catch (e) {
if (isPresent(exceptionHandler)) {
exceptionHandler.call(e, e.stack);
@ -394,7 +396,7 @@ export class ApplicationRef_ extends ApplicationRef {
constructor(private _platform: PlatformRef_, private _zone: NgZone, private _injector: Injector) {
super();
if (isPresent(this._zone)) {
ObservableWrapper.subscribe(this._zone.onTurnDone,
ObservableWrapper.subscribe(this._zone.onMicrotaskEmpty,
(_) => { this._zone.run(() => { this.tick(); }); });
}
this._enforceNoNewChanges = assertionsEnabled();
@ -434,16 +436,10 @@ export class ApplicationRef_ extends ApplicationRef {
var tickResult = PromiseWrapper.then(compRefToken, tick);
// THIS MUST ONLY RUN IN DART.
// This is required to report an error when no components with a matching selector found.
// Otherwise the promise will never be completed.
// Doing this in JS causes an extra error message to appear.
if (IS_DART) {
PromiseWrapper.then(tickResult, (_) => {});
}
PromiseWrapper.then(tickResult, null,
(err, stackTrace) => completer.reject(err, stackTrace));
PromiseWrapper.then(tickResult, null, (err, stackTrace) => {
completer.reject(err, stackTrace);
exceptionHandler.call(err, stackTrace);
});
} catch (e) {
exceptionHandler.call(e, e.stack);
completer.reject(e, e.stack);