diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 16ba597..2b02e7a 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -71,19 +71,19 @@ export class AppComponent implements OnInit { ); this.hotKeysService.addShortcut({ keys: 'Space' }).subscribe(_ => { - if (this.state.displayMode != DisplayMode.Presentation) { + if (this.state.displayMode !== DisplayMode.Presentation) { this.showDisplay(); } } ); this.hotKeysService.addShortcut({ keys: 't' }).subscribe(_ => - this.state.displayMode == DisplayMode.Theme ? this.showDisplay() : this.themeDisplay() + this.state.displayMode === DisplayMode.Theme ? this.showDisplay() : this.themeDisplay() ); this.hotKeysService.addShortcut({ keys: 'code.Period' }).subscribe(_ => - this.state.displayMode == DisplayMode.Blank ? this.showDisplay() : this.blankDisplay() + this.state.displayMode === DisplayMode.Blank ? this.showDisplay() : this.blankDisplay() ); this.hotKeysService.addShortcut({ keys: 'd' }).subscribe(_ => - this.state.displayMode == DisplayMode.Desktop ? this.showDisplay() : this.desktopDisplay() + this.state.displayMode === DisplayMode.Desktop ? this.showDisplay() : this.desktopDisplay() ); } diff --git a/src/app/hotkeys.service.ts b/src/app/hotkeys.service.ts index b1112cc..d90596d 100644 --- a/src/app/hotkeys.service.ts +++ b/src/app/hotkeys.service.ts @@ -1,18 +1,18 @@ -import { DOCUMENT } from "@angular/common"; -import { Inject, Injectable } from "@angular/core"; -import { EventManager } from "@angular/platform-browser"; -import { Observable } from "rxjs"; +import { DOCUMENT } from '@angular/common'; +import { Inject, Injectable } from '@angular/core'; +import { EventManager } from '@angular/platform-browser'; +import { Observable } from 'rxjs'; -type Options = { +interface Options { element: any; keys: string; -} +}; @Injectable({ providedIn: 'root' }) export class HotKeysService { defaults: Partial = { element: this.document - } + }; constructor(private eventManager: EventManager, @Inject(DOCUMENT) private document: Document) { } @@ -25,7 +25,7 @@ export class HotKeysService { const handler = (e: KeyboardEvent) => { if (document.URL.endsWith('/slides')) { - e.preventDefault() + e.preventDefault(); observer.next(e); } }; @@ -37,6 +37,6 @@ export class HotKeysService { return () => { dispose(); }; - }) + }); } -} \ No newline at end of file +}