6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
8
9
- import { Inject , Injectable , Optional , SkipSelf , OnDestroy } from '@angular/core' ;
10
- import { DOCUMENT } from '@angular/platform-browser' ;
9
+ import { Injectable , Optional , SkipSelf , OnDestroy } from '@angular/core' ;
11
10
import { OverlayRef } from '../overlay-ref' ;
12
11
import { Subscription } from 'rxjs/Subscription' ;
13
12
import { RxChain , filter } from '@angular/cdk/rxjs' ;
@@ -26,8 +25,6 @@ export class OverlayKeyboardDispatcher implements OnDestroy {
26
25
27
26
private _keydownEventSubscription : Subscription | null ;
28
27
29
- constructor ( @Optional ( ) @Inject ( DOCUMENT ) private _document : any ) { }
30
-
31
28
ngOnDestroy ( ) {
32
29
if ( this . _keydownEventSubscription ) {
33
30
this . _keydownEventSubscription . unsubscribe ( ) ;
@@ -58,7 +55,7 @@ export class OverlayKeyboardDispatcher implements OnDestroy {
58
55
* events to the appropriate overlay.
59
56
*/
60
57
private _subscribeToKeydownEvents ( ) : void {
61
- const bodyKeydownEvents = fromEvent < KeyboardEvent > ( this . _document . body , 'keydown' ) ;
58
+ const bodyKeydownEvents = fromEvent < KeyboardEvent > ( document . body , 'keydown' ) ;
62
59
63
60
this . _keydownEventSubscription = RxChain . from ( bodyKeydownEvents )
64
61
. call ( filter , ( ) => ! ! this . _attachedOverlays . length )
@@ -84,15 +81,15 @@ export class OverlayKeyboardDispatcher implements OnDestroy {
84
81
85
82
/** @docs -private */
86
83
export function OVERLAY_KEYBOARD_DISPATCHER_PROVIDER_FACTORY (
87
- dispatcher : OverlayKeyboardDispatcher , _document ) {
88
- return dispatcher || new OverlayKeyboardDispatcher ( _document ) ;
84
+ dispatcher : OverlayKeyboardDispatcher ) {
85
+ return dispatcher || new OverlayKeyboardDispatcher ( ) ;
89
86
}
90
87
91
88
/** @docs -private */
92
89
export const OVERLAY_KEYBOARD_DISPATCHER_PROVIDER = {
93
90
// If there is already an OverlayKeyboardDispatcher available, use that.
94
91
// Otherwise, provide a new one.
95
92
provide : OverlayKeyboardDispatcher ,
96
- deps : [ [ new Optional ( ) , new SkipSelf ( ) , OverlayKeyboardDispatcher ] , [ new Optional ( ) , DOCUMENT ] ] ,
93
+ deps : [ [ new Optional ( ) , new SkipSelf ( ) , OverlayKeyboardDispatcher ] ] ,
97
94
useFactory : OVERLAY_KEYBOARD_DISPATCHER_PROVIDER_FACTORY
98
95
} ;
0 commit comments