added customEvent to notifiy when the code is injected.

This commit is contained in:
Ali Najafizadeh
2015-12-14 10:48:17 -05:00
parent 5826145412
commit c16160ffd4
2 changed files with 12 additions and 0 deletions
+6
View File
@@ -286,6 +286,8 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
var RNWBSchema = 'wvb';
var sendQueue = [];
var receiveQueue = [];
var doc = window.document;
var customEvent = doc.createEvent('Event');
function callFunc(func, message) {
if ('function' === typeof func) {
@@ -340,6 +342,10 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
};
window.WebViewBridge = WebViewBridge;
//dispatch event
customEvent.initEvent('WebViewBridge', true, true);
doc.dispatchEvent(customEvent);
}(window));
);
}
+6
View File
@@ -9,6 +9,8 @@
var RNWBSchema = 'wvb';
var sendQueue = [];
var receiveQueue = [];
var doc = window.document;
var customEvent = doc.createEvent('Event');
function callFunc(func, message) {
if ('function' === typeof func) {
@@ -63,4 +65,8 @@
};
window.WebViewBridge = WebViewBridge;
//dispatch event
customEvent.initEvent('WebViewBridge', true, true);
doc.dispatchEvent(customEvent);
}(window));