mirror of
https://github.com/nasa/openmct.git
synced 2025-06-17 14:48:13 +00:00
[Navigation] remove mct-before-unload
Remove mct-before-unload, and move the functionality to the navigation service. The navigation service considers "unload" to be a navigation event and prompts in much the same way as it would before any other navigation event. https://github.com/nasa/openmct/issues/1360
This commit is contained in:
@ -39,6 +39,9 @@ define(
|
||||
this.callbacks = [];
|
||||
this.checks = [];
|
||||
this.$window = $window;
|
||||
|
||||
this.oldUnload = $window.onbeforeunload;
|
||||
$window.onbeforeunload = this.onBeforeUnload.bind(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -173,6 +176,22 @@ define(
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Listener for window on before unload event-- will warn before
|
||||
* navigation is allowed.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
NavigationService.prototype.onBeforeUnload = function () {
|
||||
var shouldWarnBeforeNavigate = this.shouldWarnBeforeNavigate();
|
||||
if (shouldWarnBeforeNavigate) {
|
||||
return shouldWarnBeforeNavigate;
|
||||
}
|
||||
if (this.oldUnload) {
|
||||
return this.oldUnload.apply(undefined, [].slice.apply(arguments));
|
||||
}
|
||||
};
|
||||
|
||||
return NavigationService;
|
||||
}
|
||||
);
|
||||
|
Reference in New Issue
Block a user