Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function forkInnerZoneWithAngularBehavior(zone) {
- zone._inner = zone._inner.fork({
- name: 'angular',
- properties: { isAngularZone: true },
- onInvokeTask: (delegate, current, target, task, applyThis, applyArgs) => {
- try {
- onEnter(zone);
- return delegate.invokeTask(target, task, applyThis, applyArgs);
- }
- finally {
- onLeave(zone);
- }
- },
- onInvoke: (delegate, current, target, callback, applyThis, applyArgs, source) => {
- try {
- onEnter(zone);
- return delegate.invoke(target, callback, applyThis, applyArgs, source);
- }
- finally {
- onLeave(zone);
- }
- },
- onHasTask: (delegate, current, target, 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') {
- zone.hasPendingMicrotasks = hasTaskState.microTask;
- checkStable(zone);
- }
- else if (hasTaskState.change == 'macroTask') {
- zone.hasPendingMacrotasks = hasTaskState.macroTask;
- }
- }
- },
- onHandleError: (delegate, current, target, error) => {
- delegate.handleError(target, error);
- zone.runOutsideAngular(() => zone.onError.emit(error));
- return false;
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement