Skip to content

Commit 79167db

Browse files
committed
added support for caching and reusing a site's onbeforeunload callback
thanks, @bromagosa !
1 parent 1ffb82a commit 79167db

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

morphic.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1306,7 +1306,7 @@
13061306

13071307
/*jshint esversion: 11, bitwise: false*/
13081308

1309-
var morphicVersion = '2024-January-22';
1309+
var morphicVersion = '2024-February-12';
13101310
var modules = {}; // keep track of additional loaded modules
13111311
var useBlurredShadows = true;
13121312

@@ -12469,7 +12469,11 @@ WorldMorph.prototype.initEventListeners = function () {
1246912469
false
1247012470
);
1247112471

12472+
window.cachedOnbeforeunload = window.onbeforeunload;
1247212473
window.onbeforeunload = (evt) => {
12474+
if (window.cachedOnbeforeunload) {
12475+
window.cachedOnbeforeunload.call(null, evt);
12476+
}
1247312477
var e = evt || window.event,
1247412478
msg = "Are you sure you want to leave?";
1247512479
// For IE and Firefox

0 commit comments

Comments
 (0)