mirror of
https://github.com/chuot/rdio-scanner.git
synced 2026-08-13 16:33: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: '**',
|
||||
pathMatch: 'full',
|
||||
redirectTo: '',
|
||||
}
|
||||
])
|
||||
},
|
||||
]),
|
||||
],
|
||||
})
|
||||
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 { RadioEvent } from './radio';
|
||||
import { AppRadioService } from './radio.service';
|
||||
|
|
@ -27,6 +27,14 @@ export class AppRadioComponent implements OnDestroy, OnInit {
|
|||
this._unsubscribe();
|
||||
}
|
||||
|
||||
@HostListener('window:beforeunload', ['$event'])
|
||||
private _exitNotification(event: BeforeUnloadEvent): void {
|
||||
if (this.appRadioService.live) {
|
||||
event.preventDefault();
|
||||
event.returnValue = false;
|
||||
}
|
||||
}
|
||||
|
||||
private _subscribe(): void {
|
||||
this._subscriptions.push(
|
||||
this.appRadioService.event.subscribe((event: RadioEvent) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue