CB-7690 InAppBrowser loadstart/loadstop events issues

Subscribing to events before navigating
This commit is contained in:
daserge
2014-10-15 03:23:26 +04:00
committed by sgrebnov
parent 71b43d39a4
commit 3f80b0b59c
3 changed files with 22 additions and 13 deletions
+7 -1
View File
@@ -77,7 +77,7 @@ InAppBrowser.prototype = {
}
};
module.exports = function(strUrl, strWindowName, strWindowFeatures) {
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');
@@ -86,6 +86,12 @@ module.exports = function(strUrl, strWindowName, strWindowFeatures) {
strUrl = urlutil.makeAbsolute(strUrl);
var iab = new InAppBrowser();
callbacks = callbacks || {};
for (var callbackName in callbacks) {
iab.addEventListener(callbackName, callbacks[callbackName]);
}
var cb = function(eventname) {
iab._eventHandler(eventname);
};