mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-10-13 03:21:42 +00:00
Refactor browser unload task handling
Make it possible to register multiple task functions that will be called when the window is unloaded
This commit is contained in:
@@ -75,14 +75,14 @@ function SaverHandler(options) {
|
||||
}
|
||||
});
|
||||
// Set up our beforeunload handler
|
||||
window.onbeforeunload = function(event) {
|
||||
$tw.addUnloadTask(function(event) {
|
||||
var confirmationMessage;
|
||||
if(self.isDirty()) {
|
||||
confirmationMessage = $tw.language.getString("UnsavedChangesWarning");
|
||||
event.returnValue = confirmationMessage; // Gecko
|
||||
}
|
||||
return confirmationMessage;
|
||||
};
|
||||
});
|
||||
}
|
||||
// Install the save action handlers
|
||||
if($tw.browser) {
|
||||
|
||||
Reference in New Issue
Block a user