mirror of
https://github.com/chuot/rdio-scanner.git
synced 2026-08-16 01:43:01 -06:00
Prevent navigating away if live feed is on
This commit is contained in:
parent
48df618d93
commit
8b299ef5d5
|
|
@ -22,8 +22,8 @@ import { AppSharedModule } from './shared/shared.module';
|
||||||
path: '**',
|
path: '**',
|
||||||
pathMatch: 'full',
|
pathMatch: 'full',
|
||||||
redirectTo: '',
|
redirectTo: '',
|
||||||
}
|
},
|
||||||
])
|
]),
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class AppModule { }
|
export class AppModule { }
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
import { Component, HostListener, OnDestroy, OnInit } from '@angular/core';
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
import { RadioEvent } from './radio';
|
import { RadioEvent } from './radio';
|
||||||
import { AppRadioService } from './radio.service';
|
import { AppRadioService } from './radio.service';
|
||||||
|
|
@ -27,6 +27,14 @@ export class AppRadioComponent implements OnDestroy, OnInit {
|
||||||
this._unsubscribe();
|
this._unsubscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@HostListener('window:beforeunload', ['$event'])
|
||||||
|
private _exitNotification(event: BeforeUnloadEvent): void {
|
||||||
|
if (this.appRadioService.live) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.returnValue = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private _subscribe(): void {
|
private _subscribe(): void {
|
||||||
this._subscriptions.push(
|
this._subscriptions.push(
|
||||||
this.appRadioService.event.subscribe((event: RadioEvent) => {
|
this.appRadioService.event.subscribe((event: RadioEvent) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue