NativeApis.js
803 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
33
34
35
36
37
38
39
export const NativeMethodNames = {
AppInfoApi: 'nativeAppInfo',
AppShare: 'nativeAppShare',
}
export const JsMethodNames = {
PayResult: 'payResult'
}
export const JsInterfaces = objVal2Array(JsMethodNames)
export const NativeApi = {
on: (jsMethodName, callback) => {
$api.on(jsMethodName, callback)
},
call: (nativeMethodName, param, isBack) => {
return $api.call(nativeMethodName, param, isBack)
},
nativeAppInfo: (param) => {
return $api.call(NativeMethodNames.AppInfoApi, param, true)
},
nativeAppShare: (param) => {
return $api.call(NativeMethodNames.AppShare, param, true)
}
}
function objVal2Array(obj) {
const arrays = []
for (const key in obj) {
arrays.push(obj[key])
}
return arrays
}