| 778 | mark('Zone'); |
| 779 | |
| 780 | class ZoneImpl implements AmbientZone { |
| 781 | static __symbol__: (name: string) => string = __symbol__; |
| 782 | |
| 783 | static assertZonePatched() { |
| 784 | if (global['Promise'] !== patches['ZoneAwarePromise']) { |
| 785 | throw new Error( |
| 786 | 'Zone.js has detected that ZoneAwarePromise `(window|global).Promise` ' + |
| 787 | 'has been overwritten.\n' + |
| 788 | 'Most likely cause is that a Promise polyfill has been loaded ' + |
| 789 | 'after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. ' + |
| 790 | 'If you must load one, do so before loading zone.js.)', |
| 791 | ); |
| 792 | } |
| 793 | } |
| 794 | |
| 795 | static get root(): AmbientZone { |
| 796 | let zone = ZoneImpl.current; |
| 797 | while (zone.parent) { |
| 798 | zone = zone.parent; |
| 799 | } |
| 800 | return zone; |
| 801 | } |
| 802 | |
| 803 | static get current(): AmbientZone { |
| 804 | return _currentZoneFrame.zone; |
| 805 | } |
| 806 | |
| 807 | static get currentTask(): Task | null { |
| 808 | return _currentTask; |
| 809 | } |
| 810 | |
| 811 | static __load_patch(name: string, fn: PatchFn, ignoreDuplicate = false): void { |
| 812 | if (Object.hasOwn(patches, name)) { |
| 813 | // `checkDuplicate` option is defined from global variable |
| 814 | // so it works for all modules. |
| 815 | // `ignoreDuplicate` can work for the specified module |
| 816 | const checkDuplicate = global[__symbol__('forceDuplicateZoneCheck')] === true; |
| 817 | if (!ignoreDuplicate && checkDuplicate) { |
| 818 | throw Error('Already loaded patch: ' + name); |
| 819 | } |
| 820 | } else if (!global['__Zone_disable_' + name]) { |
| 821 | const perfName = 'Zone:' + name; |
| 822 | mark(perfName); |
| 823 | patches[name] = fn(global, ZoneImpl, _api); |
| 824 | performanceMeasure(perfName, perfName); |
| 825 | } |
| 826 | } |
| 827 | |
| 828 | public get parent(): AmbientZone | null { |
| 829 | return this._parent; |
| 830 | } |
| 831 | |
| 832 | public get name(): string { |
| 833 | return this._name; |
| 834 | } |
| 835 | |
| 836 | private _parent: ZoneImpl | null; |
| 837 | private _name: string; |
nothing calls this directly
no outgoing calls
no test coverage detected