Ignore error when attempting to remove IAB event listeners

This commit is contained in:
Skylar Ittner 2021-09-22 20:28:01 -06:00
parent f2b013bee2
commit 8dca406184

View File

@ -184,11 +184,17 @@ function initCordova() {
}
cordovaInAppBrowserRef = cordova.InAppBrowser.open(url, "_blank", options);
if (typeof onclose == "function") {
cordovaInAppBrowserRef.removeEventListener("exit");
try {
cordovaInAppBrowserRef.removeEventListener("exit");
} catch (ex) {
}
cordovaInAppBrowserRef.addEventListener("exit", onclose);
}
if (typeof onmessage == "function") {
cordovaInAppBrowserRef.removeEventListener("message");
try {
cordovaInAppBrowserRef.removeEventListener("message");
} catch (ex) {
}
cordovaInAppBrowserRef.addEventListener("message", onmessage);
}
}