-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
29 lines (24 loc) · 814 Bytes
/
index.js
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
import simulator from "../../build/simulator";
import { log } from "./util";
log("native inject js into webview");
simulator();
log("web page import hybrid js sdk");
import hybrid from "../../build";
log(
'web -> native: hybrid.dispatch("answer/writeAnswer", { id: 123456789 })'
);
hybrid
.dispatch("answer/writeAnswer", { id: 123456789 })
.then(console.log)
.catch(console.error);
log('hybrid.dispatch("base/openURL", { url: "www.twitter.com" });');
hybrid
.dispatch("base/openURL", { url: "www.twitter.com" })
.then(console.log)
.catch(console.error);
log(
'web -> native -> web: hybrid.listen("base/networkChange", console.log)'
);
const unsubscribe1 = hybrid.listen("base/networkChange", console.log);
const unsubscribe2 = hybrid.listen("base/networkChange", console.log);
unsubscribe2();