Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. function forkInnerZoneWithAngularBehavior(zone) {
  2. zone._inner = zone._inner.fork({
  3. name: 'angular',
  4. properties: { isAngularZone: true },
  5. onInvokeTask: (delegate, current, target, task, applyThis, applyArgs) => {
  6. try {
  7. onEnter(zone);
  8. return delegate.invokeTask(target, task, applyThis, applyArgs);
  9. }
  10. finally {
  11. onLeave(zone);
  12. }
  13. },
  14. onInvoke: (delegate, current, target, callback, applyThis, applyArgs, source) => {
  15. try {
  16. onEnter(zone);
  17. return delegate.invoke(target, callback, applyThis, applyArgs, source);
  18. }
  19. finally {
  20. onLeave(zone);
  21. }
  22. },
  23. onHasTask: (delegate, current, target, hasTaskState) => {
  24. delegate.hasTask(target, hasTaskState);
  25. if (current === target) {
  26. // We are only interested in hasTask events which originate from our zone
  27. // (A child hasTask event is not interesting to us)
  28. if (hasTaskState.change == 'microTask') {
  29. zone.hasPendingMicrotasks = hasTaskState.microTask;
  30. checkStable(zone);
  31. }
  32. else if (hasTaskState.change == 'macroTask') {
  33. zone.hasPendingMacrotasks = hasTaskState.macroTask;
  34. }
  35. }
  36. },
  37. onHandleError: (delegate, current, target, error) => {
  38. delegate.handleError(target, error);
  39. zone.runOutsideAngular(() => zone.onError.emit(error));
  40. return false;
  41. }
  42. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement