Repository: cordova-plugin-wkwebview-engine Updated Branches: refs/heads/master 1ca9684b4 -> b5c8de507
CB-10106 - iOS bridges need to take into account bridge changes Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/commit/b5c8de50 Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/tree/b5c8de50 Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/diff/b5c8de50 Branch: refs/heads/master Commit: b5c8de507b27c83ac3952d1114532b2c5307539b Parents: 1ca9684 Author: Shazron Abdullah <[email protected]> Authored: Tue Dec 1 10:15:27 2015 -0800 Committer: Shazron Abdullah <[email protected]> Committed: Tue Dec 1 10:15:27 2015 -0800 ---------------------------------------------------------------------- src/www/ios/ios-wkwebview-exec.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/blob/b5c8de50/src/www/ios/ios-wkwebview-exec.js ---------------------------------------------------------------------- diff --git a/src/www/ios/ios-wkwebview-exec.js b/src/www/ios/ios-wkwebview-exec.js index 10c78e7..20a775a 100644 --- a/src/www/ios/ios-wkwebview-exec.js +++ b/src/www/ios/ios-wkwebview-exec.js @@ -80,7 +80,9 @@ function convertMessageToArgsNativeToJs(message) { return args; } -function iOSExec() { +var iOSExec = function() { + + // detect change in bridge, if there is a change, we forward to new bridge // if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.cordova && window.webkit.messageHandlers.cordova.postMessage) { // bridgeMode = jsToNativeModes.WK_WEBVIEW_BINDING; @@ -133,5 +135,12 @@ iOSExec.nativeCallback = function(callbackId, status, message, keepCallback, deb }, 0); }; +// unregister the old bridge +cordova.define.remove('cordova/exec'); +// redefine bridge to our new bridge +cordova.define("cordova/exec", function(require, exports, module) { + module.exports = iOSExec; +}); + module.exports = iOSExec; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
