CB-10428 Fix syntax error when browserifying inAppBrowser plugin

github close #141
This commit is contained in:
sgrebnov 2016-01-26 12:06:49 +03:00
parent 8da5e25eee
commit 2e0dc26eaa

View File

@ -19,27 +19,28 @@
*
*/
// special patch to correctly work on Ripple emulator (CB-9760)
if (window.parent && !!window.parent.ripple) { // https://gist.github.com/triceam/4658021
(function() {
// special patch to correctly work on Ripple emulator (CB-9760)
if (window.parent && !!window.parent.ripple) { // https://gist.github.com/triceam/4658021
module.exports = window.open.bind(window); // fallback to default window.open behaviour
return;
}
}
var exec = require('cordova/exec');
var channel = require('cordova/channel');
var modulemapper = require('cordova/modulemapper');
var urlutil = require('cordova/urlutil');
var exec = require('cordova/exec');
var channel = require('cordova/channel');
var modulemapper = require('cordova/modulemapper');
var urlutil = require('cordova/urlutil');
function InAppBrowser() {
function InAppBrowser() {
this.channels = {
'loadstart': channel.create('loadstart'),
'loadstop' : channel.create('loadstop'),
'loaderror' : channel.create('loaderror'),
'exit' : channel.create('exit')
};
}
}
InAppBrowser.prototype = {
InAppBrowser.prototype = {
_eventHandler: function (event) {
if (event && (event.type in this.channels)) {
this.channels[event.type].fire(event);
@ -81,9 +82,9 @@ InAppBrowser.prototype = {
throw new Error('insertCSS requires exactly one of code or file to be specified');
}
}
};
};
module.exports = function(strUrl, strWindowName, strWindowFeatures, callbacks) {
module.exports = function(strUrl, strWindowName, strWindowFeatures, callbacks) {
// Don't catch calls that write to existing frames (e.g. named iframes).
if (window.frames && window.frames[strWindowName]) {
var origOpenFunc = modulemapper.getOriginalSymbol(window, 'open');
@ -106,5 +107,5 @@ module.exports = function(strUrl, strWindowName, strWindowFeatures, callbacks) {
exec(cb, cb, "InAppBrowser", "open", [strUrl, strWindowName, strWindowFeatures]);
return iab;
};
};
})();