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