-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreact-native-sdk.js
41 lines (41 loc) · 981 Bytes
/
react-native-sdk.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
30
31
32
33
34
35
36
37
38
39
40
41
const i = (e) => {
var t;
(t = window.ReactNativeWebView) == null || t.postMessage(JSON.stringify(e));
}, n = (e) => {
i({
type: "share",
data: {
detail: e.detail
}
});
}, o = (e) => {
i({
type: "shareToIM",
data: {
detail: e.detail
}
});
}, a = (e) => {
i({
type: "goweboffice",
data: {
detail: e.detail
}
});
}, d = (e) => {
i({
type: "exitweboffice",
data: {
detail: e.detail
}
});
};
function s() {
var t;
console.log("Mobile SDK initialized");
const e = (t = window.getDocInstance) == null ? void 0 : t.call(window);
e && (e.addEventListener("share", n), e.addEventListener("shareToIM", o), e.addEventListener("goweboffice", a), e.addEventListener("exitweboffice", d), window.onbeforeunload = () => {
e.removeEventListener("share", n), e.removeEventListener("shareToIM", o), e.removeEventListener("goweboffice", a), e.removeEventListener("exitweboffice", d);
});
}
s();