* If the devtools extension is connected out of the Angular zone, * this operator will emit all events within the zone.
({
ngZone,
connectInZone,
}: ZoneConfig)
| 222 | * this operator will emit all events within the zone. |
| 223 | */ |
| 224 | function emitInZone<T>({ |
| 225 | ngZone, |
| 226 | connectInZone, |
| 227 | }: ZoneConfig): MonoTypeOperatorFunction<T> { |
| 228 | return (source) => |
| 229 | connectInZone |
| 230 | ? new Observable<T>((subscriber) => |
| 231 | source.subscribe({ |
| 232 | next: (value) => ngZone.run(() => subscriber.next(value)), |
| 233 | error: (error) => ngZone.run(() => subscriber.error(error)), |
| 234 | complete: () => ngZone.run(() => subscriber.complete()), |
| 235 | }) |
| 236 | ) |
| 237 | : source; |
| 238 | } |