mirror of
https://github.com/status-im/react-native-webview-bridge.git
synced 2026-08-27 11:21:14 +00:00
added customEvent to notifiy when the code is injected.
This commit is contained in:
@@ -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));
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user