@@ -10,7 +10,7 @@ import {Direction, Directionality} from '@angular/cdk/bidi';
10
10
import { ComponentPortal , Portal , PortalOutlet , TemplatePortal } from '@angular/cdk/portal' ;
11
11
import { ComponentRef , EmbeddedViewRef , NgZone } from '@angular/core' ;
12
12
import { Location } from '@angular/common' ;
13
- import { Observable , Subject , merge , SubscriptionLike , Subscription , Observer } from 'rxjs' ;
13
+ import { Observable , Subject , merge , SubscriptionLike , Subscription } from 'rxjs' ;
14
14
import { take , takeUntil } from 'rxjs/operators' ;
15
15
import { OverlayKeyboardDispatcher } from './keyboard/overlay-keyboard-dispatcher' ;
16
16
import { OverlayConfig } from './overlay-config' ;
@@ -45,23 +45,9 @@ export class OverlayRef implements PortalOutlet, OverlayReference {
45
45
*/
46
46
private _previousHostParent : HTMLElement ;
47
47
48
- private _keydownEventsObservable : Observable < KeyboardEvent > =
49
- new Observable ( ( observer : Observer < KeyboardEvent > ) => {
50
- const subscription = this . _keydownEvents . subscribe ( observer ) ;
51
- this . _keydownEventSubscriptions ++ ;
52
-
53
- return ( ) => {
54
- subscription . unsubscribe ( ) ;
55
- this . _keydownEventSubscriptions -- ;
56
- } ;
57
- } ) ;
58
-
59
48
/** Stream of keydown events dispatched to this overlay. */
60
49
_keydownEvents = new Subject < KeyboardEvent > ( ) ;
61
50
62
- /** Amount of subscriptions to the keydown events. */
63
- _keydownEventSubscriptions = 0 ;
64
-
65
51
constructor (
66
52
private _portalOutlet : PortalOutlet ,
67
53
private _host : HTMLElement ,
@@ -265,7 +251,7 @@ export class OverlayRef implements PortalOutlet, OverlayReference {
265
251
266
252
/** Gets an observable of keydown events targeted to this overlay. */
267
253
keydownEvents ( ) : Observable < KeyboardEvent > {
268
- return this . _keydownEventsObservable ;
254
+ return this . _keydownEvents . asObservable ( ) ;
269
255
}
270
256
271
257
/** Gets the current overlay configuration, which is immutable. */
0 commit comments