(options: {
enableLongStackTrace?: boolean;
shouldCoalesceEventChangeDetection?: boolean;
shouldCoalesceRunChangeDetection?: boolean;
})
| 137 | readonly onError: EventEmitter<any> = new EventEmitter(false); |
| 138 | |
| 139 | constructor(options: { |
| 140 | enableLongStackTrace?: boolean; |
| 141 | shouldCoalesceEventChangeDetection?: boolean; |
| 142 | shouldCoalesceRunChangeDetection?: boolean; |
| 143 | }) { |
| 144 | const { |
| 145 | enableLongStackTrace = false, |
| 146 | shouldCoalesceEventChangeDetection = false, |
| 147 | shouldCoalesceRunChangeDetection = false, |
| 148 | scheduleInRootZone = SCHEDULE_IN_ROOT_ZONE_DEFAULT, |
| 149 | } = options as InternalNgZoneOptions; |
| 150 | |
| 151 | if (typeof Zone == 'undefined') { |
| 152 | throw new RuntimeError( |
| 153 | RuntimeErrorCode.MISSING_ZONEJS, |
| 154 | ngDevMode && `In this configuration Angular requires Zone.js`, |
| 155 | ); |
| 156 | } |
| 157 | |
| 158 | Zone.assertZonePatched(); |
| 159 | const self = this as any as NgZonePrivate; |
| 160 | self._nesting = 0; |
| 161 | |
| 162 | self._outer = self._inner = Zone.current; |
| 163 | |
| 164 | // AsyncStackTaggingZoneSpec provides `linked stack traces` to show |
| 165 | // where the async operation is scheduled. For more details, refer |
| 166 | // to this article, https://developer.chrome.com/blog/devtools-better-angular-debugging/ |
| 167 | // And we only import this AsyncStackTaggingZoneSpec in development mode, |
| 168 | // in the production mode, the AsyncStackTaggingZoneSpec will be tree shaken away. |
| 169 | if (ngDevMode) { |
| 170 | self._inner = self._inner.fork(new AsyncStackTaggingZoneSpec('Angular')); |
| 171 | } |
| 172 | |
| 173 | if ((Zone as any)['TaskTrackingZoneSpec']) { |
| 174 | self._inner = self._inner.fork(new ((Zone as any)['TaskTrackingZoneSpec'] as any)()); |
| 175 | } |
| 176 | |
| 177 | if (enableLongStackTrace && (Zone as any)['longStackTraceZoneSpec']) { |
| 178 | self._inner = self._inner.fork((Zone as any)['longStackTraceZoneSpec']); |
| 179 | } |
| 180 | // if shouldCoalesceRunChangeDetection is true, all tasks including event tasks will be |
| 181 | // coalesced, so shouldCoalesceEventChangeDetection option is not necessary and can be skipped. |
| 182 | self.shouldCoalesceEventChangeDetection = |
| 183 | !shouldCoalesceRunChangeDetection && shouldCoalesceEventChangeDetection; |
| 184 | self.shouldCoalesceRunChangeDetection = shouldCoalesceRunChangeDetection; |
| 185 | self.callbackScheduled = false; |
| 186 | self.scheduleInRootZone = scheduleInRootZone; |
| 187 | forkInnerZoneWithAngularBehavior(self); |
| 188 | } |
| 189 | |
| 190 | /** |
| 191 | This method checks whether the method call happens within an Angular Zone instance. |
nothing calls this directly
no test coverage detected