Implement state recovery, make ask before reload opt-in

This commit is contained in:
Kristóf Tóth
2018-07-20 09:24:28 +02:00
parent 362804f54d
commit bc50d52f4d
3 changed files with 16 additions and 5 deletions
+7 -5
View File
@@ -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;
});
}
}
}