Commit b521a9d0 authored by ibuler's avatar ibuler

[Update] 关闭窗口时确认

parent c251ce88
...@@ -5,8 +5,9 @@ ...@@ -5,8 +5,9 @@
* @date 2017-11-07 * @date 2017-11-07
* @author liuzheng <liuzheng712@gmail.com> * @author liuzheng <liuzheng712@gmail.com>
*/ */
import {Component} from '@angular/core'; import {Component, HostListener} from '@angular/core';
import {DataStore} from '../globals'; import {DataStore} from '../globals';
import { environment } from '../../environments/environment';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
...@@ -16,4 +17,14 @@ import {DataStore} from '../globals'; ...@@ -16,4 +17,14 @@ import {DataStore} from '../globals';
export class AppComponent { export class AppComponent {
DataStore = DataStore; DataStore = DataStore;
constructor() {}
@HostListener('window:beforeunload', ['$event'])
unloadNotification($event: any) {
if (environment.production) {
$event.returnValue = true;
}
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment