Mirror navigator online flag in observable state
This commit is contained in:
@@ -98,13 +98,23 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
@HostListener('document:keyup', ['$event'])
|
||||
keyUp(event: KeyboardEvent) {
|
||||
onKeyUp(event: KeyboardEvent) {
|
||||
let x = event.keyCode;
|
||||
if (x === 27) {
|
||||
this.store.dispatch(new commonActions.Escape(true,false));
|
||||
}
|
||||
}
|
||||
|
||||
@HostListener('window:online', ['$event'])
|
||||
onOnline(event: Event) {
|
||||
this.store.dispatch(new commonActions.Online());
|
||||
}
|
||||
|
||||
@HostListener('window:offline', ['$event'])
|
||||
onOffline(event: Event) {
|
||||
this.store.dispatch(new commonActions.Offline());
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
// Subscription clean-up
|
||||
if(this.routerSub$) this.routerSub$.unsubscribe();
|
||||
|
Reference in New Issue
Block a user