-
Notifications
You must be signed in to change notification settings - Fork 127
Expand file tree
/
Copy pathscript.js
More file actions
32 lines (28 loc) · 999 Bytes
/
Copy pathscript.js
File metadata and controls
32 lines (28 loc) · 999 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function callJS() {
return 'Response from JS';
}
function callNative() {
window.kmpJsBridge.callNative("Greet",JSON.stringify({message: "Hello"}),
function (data) {
document.getElementById("subtitle").innerText = data;
console.log("Greet from Native: " + data);
}
);
}
function callAndroid() {
window.androidJsBridge.call('1', 'callAndroid', '{"name":"callAndroid"}');
}
function callIOS() {
window.webkit.messageHandlers.iosJsBridge.postMessage("{\"id\":\"1\",\"methodName\":\"callIOS\",\"params\":\"{\\\"type\\\":\\\"1\\\"}\"}");
}
function callDesktop() {
window.cefQuery({
request: "{\"id\":\"1\",\"methodName\":\"callIOS\",\"params\":\"{\\\"type\\\":\\\"1\\\"}\"}",
onSuccess: function(response) {
// 处理Java应用程序的响应
},
onFailure: function(errorCode, errorMessage) {
// 处理错误
}
});
}