import { SubscriptionLike } from 'rxjs'; export class SubscriberList implements SubscriptionLike { private mList: SubscriptionLike[] = []; private mClosed = false; get closed(): boolean { return this.mClosed; } add(s: SubscriptionLike): SubscriptionLike { if (s != null) { this.mList.push(s); } return s; } unsubscribe(): void { this.mClosed = true; this.mList.forEach(s => { if (!s.closed) { s.unsubscribe(); } }); } }