Repository: cordova-plugin-wkwebview-engine Updated Branches: refs/heads/master 06b909813 -> 6340ef072
CB-10106 - added bridge proxy 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/6340ef07 Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/tree/6340ef07 Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/diff/6340ef07 Branch: refs/heads/master Commit: 6340ef0729458b604fd964215135a482d4124053 Parents: 06b9098 Author: Shazron Abdullah <[email protected]> Authored: Fri Dec 4 01:29:32 2015 -0800 Committer: Shazron Abdullah <[email protected]> Committed: Fri Dec 4 01:29:32 2015 -0800 ---------------------------------------------------------------------- src/www/ios/ios-wkwebview-exec.js | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/blob/6340ef07/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 b4d07ad..493eb98 100644 --- a/src/www/ios/ios-wkwebview-exec.js +++ b/src/www/ios/ios-wkwebview-exec.js @@ -144,13 +144,36 @@ iOSExec.nativeEvalAndFetch = function(func) { } }; +// Proxy the exec for bridge changes. See CB-10106 + +function cordovaExec() { + var cexec = require('cordova/exec'); + var cexec_valid = (typeof cexec.nativeFetchMessages === 'function') && (typeof cexec.nativeEvalAndFetch === 'function') && (typeof cexec.nativeCallback === 'function'); + return (cexec_valid && execProxy !== cexec)? cexec : iOSExec; +} + +function execProxy() { + cordovaExec().apply(null, arguments); +}; + +execProxy.nativeFetchMessages = function() { + return cordovaExec().nativeFetchMessages.apply(null, arguments); +}; + +execProxy.nativeEvalAndFetch = function() { + return cordovaExec().nativeEvalAndFetch.apply(null, arguments); +}; + +execProxy.nativeCallback = function() { + return cordovaExec().nativeCallback.apply(null, arguments); +}; + +module.exports = execProxy; + // 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 = execProxy; }); - - -module.exports = iOSExec; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
