
com.google.gwt.user.client.impl.initWindowCloseHandler.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gwt-mock-2.5.1 Show documentation
Show all versions of gwt-mock-2.5.1 Show documentation
A mocked implementation for GWT-2.5.1 that can run in the JVM to allow integration testing
The newest version!
function __gwt_initWindowCloseHandler(beforeunload, unload) {
var wnd = window
, oldOnBeforeUnload = wnd.onbeforeunload
, oldOnUnload = wnd.onunload;
wnd.onbeforeunload = function(evt) {
var ret, oldRet;
try {
ret = beforeunload();
} finally {
oldRet = oldOnBeforeUnload && oldOnBeforeUnload(evt);
}
// Avoid returning null as IE6 will coerce it into a string.
// Ensure that "" gets returned properly.
if (ret != null) {
return ret;
}
if (oldRet != null) {
return oldRet;
}
// returns undefined.
};
wnd.onunload = function(evt) {
try {
unload();
} finally {
oldOnUnload && oldOnUnload(evt);
wnd.onresize = null;
wnd.onscroll = null;
wnd.onbeforeunload = null;
wnd.onunload = null;
}
};
// Remove the reference once we've initialize the handler
wnd.__gwt_initWindowCloseHandler = undefined;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy