mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-11-08 11:32:59 +00:00
Switch from addEventListener to onbeforeunload
This makes it possible for TiddlyDesktop to reuse these functions to handle detecting unsaved changes
This commit is contained in:
@@ -75,14 +75,14 @@ function SaverHandler(options) {
|
||||
}
|
||||
});
|
||||
// Set up our beforeunload handler
|
||||
window.addEventListener("beforeunload",function(event) {
|
||||
window.onbeforeunload = 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