Implement state recovery, make ask before reload opt-in
This commit is contained in:
@@ -17,10 +17,12 @@ export class AppComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.titleService.setTitle(this.documentTitle);
|
||||
window.addEventListener('beforeunload', (event) => {
|
||||
const confirmationMessage = 'Refreshing this page may mess up your challenge/tutorial state. Are you sure?';
|
||||
event.returnValue = confirmationMessage;
|
||||
return confirmationMessage;
|
||||
});
|
||||
if (config.dashboard.askReloadSite) {
|
||||
window.addEventListener('beforeunload', (event) => {
|
||||
const confirmationMessage = 'Refreshing this page may mess up your challenge/tutorial state. Are you sure?';
|
||||
event.returnValue = confirmationMessage;
|
||||
return confirmationMessage;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user