rx-event-helper.ts 450 B

12345678910111213141516171819
  1. /**
  2. * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author David Sehnal <david.sehnal@gmail.com>
  5. */
  6. import { Subject } from 'rxjs';
  7. export class RxEventHelper {
  8. private _eventList: Subject<any>[] = [];
  9. create<T>() {
  10. const s = new Subject<T>();
  11. this._eventList.push(s);
  12. return s;
  13. }
  14. dispose() {
  15. for (const e of this._eventList) e.complete();
  16. }
  17. }