Commit ec74e6b8 authored by 郑磊's avatar 郑磊

update

parent 93a89c4c
...@@ -51,22 +51,17 @@ function callAndroidApi(name: string, ...args: any[]): void { ...@@ -51,22 +51,17 @@ function callAndroidApi(name: string, ...args: any[]): void {
let ack: Function | undefined = undefined let ack: Function | undefined = undefined
if (typeof args[0] === 'function') { if (typeof args[0] === 'function') {
ack = args[0] ack = args[0]
} else if (typeof args[1] === 'function') { } else {
params = args[0] params = args[0]
ack = args[1] ack = args[1]
} }
let result: any const invokeArgs: any[] = []
if (typeof params !== 'undefined' && params !== null) { if (typeof params !== 'undefined' && params !== null) {
//result = window.liveapp[name](JSON.stringify(params)) invokeArgs.push(JSON.stringify(params))
params = JSON.stringify(JSON.stringify(params))
} else {
params = ''
} }
const result = window.liveapp[name](...invokeArgs)
const evalCode = `window.liveapp.${name}(${params})`
console.log(evalCode)
result = eval(evalCode)
if (typeof ack === 'function') { if (typeof ack === 'function') {
ack(result) ack(result)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment