https://github.com/angular/angular
Raw File
Tip revision: e8c8a8df6a7331d8bf096d0dd95feb854c9c5f87 authored by Amit Gharat on 13 November 2020, 17:41:16 UTC
docs: add Angular + NgRx book by the asian BPB Publications (#39680)
Tip revision: e8c8a8d
ng_zone_mock.ts
/**
 * @license
 * Copyright Google LLC All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://angular.io/license
 */

import {EventEmitter, Injectable, NgZone} from '@angular/core';


/**
 * A mock implementation of {@link NgZone}.
 */
@Injectable()
export class MockNgZone extends NgZone {
  onStable: EventEmitter<any> = new EventEmitter(false);

  constructor() {
    super({enableLongStackTrace: false, shouldCoalesceEventChangeDetection: false});
  }

  run(fn: Function): any {
    return fn();
  }

  runOutsideAngular(fn: Function): any {
    return fn();
  }

  simulateZoneExit(): void {
    this.onStable.emit(null);
  }
}
back to top