From e651389a2b845b843b27ae444404ecce17b18bb7 Mon Sep 17 00:00:00 2001 From: Damyan Petev Date: Tue, 13 Nov 2018 10:21:18 +0200 Subject: [PATCH] refactor(toggle): update overlay subscription filter to tuple (#2898) --- .../src/lib/directives/toggle/toggle.directive.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/projects/igniteui-angular/src/lib/directives/toggle/toggle.directive.ts b/projects/igniteui-angular/src/lib/directives/toggle/toggle.directive.ts index 6838116307f..a497bc06804 100644 --- a/projects/igniteui-angular/src/lib/directives/toggle/toggle.directive.ts +++ b/projects/igniteui-angular/src/lib/directives/toggle/toggle.directive.ts @@ -17,7 +17,7 @@ import { IgxNavigationService, IToggleView } from '../../core/navigation'; import { IgxOverlayService } from '../../services/overlay/overlay'; import { OverlaySettings, OverlayEventArgs, ConnectedPositioningStrategy, AbsoluteScrollStrategy } from '../../services'; import { filter, takeUntil } from 'rxjs/operators'; -import { Subscription, OperatorFunction, Subject } from 'rxjs'; +import { Subscription, Subject, MonoTypeOperatorFunction } from 'rxjs'; import { OverlayCancelableEventArgs } from '../../services/overlay/utilities'; import { CancelableEventArgs } from '../../core/utils'; @@ -28,8 +28,9 @@ import { CancelableEventArgs } from '../../core/utils'; export class IgxToggleDirective implements IToggleView, OnInit, OnDestroy { private _overlayId: string; private destroy$ = new Subject(); - private _overlaySubFilter: OperatorFunction[] = [ - filter(x => x.id === this._overlayId) + private _overlaySubFilter: [MonoTypeOperatorFunction, MonoTypeOperatorFunction] = [ + filter(x => x.id === this._overlayId), + takeUntil(this.destroy$) ]; private _overlayOpenedSub: Subscription; private _overlayClosingSub: Subscription; @@ -189,12 +190,12 @@ export class IgxToggleDirective implements IToggleView, OnInit, OnDestroy { } this.unsubscribe(); - this._overlayOpenedSub = this.overlayService.onOpened.pipe(...this._overlaySubFilter, takeUntil(this.destroy$)).subscribe(() => { + this._overlayOpenedSub = this.overlayService.onOpened.pipe(...this._overlaySubFilter).subscribe(() => { this.onOpened.emit(); }); this._overlayClosingSub = this.overlayService .onClosing - .pipe(...this._overlaySubFilter, takeUntil(this.destroy$)) + .pipe(...this._overlaySubFilter) .subscribe((e: OverlayCancelableEventArgs) => { const eventArgs: CancelableEventArgs = { cancel: false }; this.onClosing.emit(eventArgs); @@ -208,7 +209,7 @@ export class IgxToggleDirective implements IToggleView, OnInit, OnDestroy { } }); this._overlayClosedSub = this.overlayService.onClosed - .pipe(...this._overlaySubFilter, takeUntil(this.destroy$)) + .pipe(...this._overlaySubFilter) .subscribe(this.overlayClosed); }