mirror of
https://github.com/nasa/openmct.git
synced 2025-06-16 06:08:11 +00:00
[Edit] Add clarifying comments
Add clarifying comments related to checking of conditions on unload, WTD-1035.
This commit is contained in:
@ -31,9 +31,19 @@ define(
|
|||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
/**
|
||||||
|
* Get the domain object which is navigated-to.
|
||||||
|
* @returns {DomainObject} the domain object that is navigated-to
|
||||||
|
*/
|
||||||
navigatedObject: function () {
|
navigatedObject: function () {
|
||||||
return navigatedObject;
|
return navigatedObject;
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Get the warning to show if the user attempts to navigate
|
||||||
|
* away from Edit mode while unsaved changes are present.
|
||||||
|
* @returns {string} the warning to show, or undefined if
|
||||||
|
* there are no unsaved changes
|
||||||
|
*/
|
||||||
getUnloadWarning: function () {
|
getUnloadWarning: function () {
|
||||||
var editorCapability = navigatedObject &&
|
var editorCapability = navigatedObject &&
|
||||||
navigatedObject.getCapability("editor"),
|
navigatedObject.getCapability("editor"),
|
||||||
|
@ -43,12 +43,14 @@ define(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Include this instance of the directive's unload function
|
|
||||||
unloads.push(unload);
|
|
||||||
|
|
||||||
// If this is the first active instance of this directive,
|
// If this is the first active instance of this directive,
|
||||||
// register as the window's beforeunload handler
|
// register as the window's beforeunload handler
|
||||||
|
if (unloads.length === 0) {
|
||||||
$window.onbeforeunload = checkUnloads;
|
$window.onbeforeunload = checkUnloads;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Include this instance of the directive's unload function
|
||||||
|
unloads.push(unload);
|
||||||
|
|
||||||
// Remove it when the scope is destroyed
|
// Remove it when the scope is destroyed
|
||||||
scope.$on("$destroy", removeUnload);
|
scope.$on("$destroy", removeUnload);
|
||||||
|
Reference in New Issue
Block a user