Commit 66e27b10 authored by 郑磊's avatar 郑磊

更新原生调用

parent e47e1e2f
...@@ -56,11 +56,12 @@ function callAndroidApi(name: string, ...args: any[]): void { ...@@ -56,11 +56,12 @@ function callAndroidApi(name: string, ...args: any[]): void {
ack = args[1] ack = args[1]
} }
const invokeArgs: Parameters<(typeof window.liveapp)[string]> = [] let result: any
if (typeof params !== 'undefined' && params !== null) { if (typeof params !== 'undefined' && params !== null) {
invokeArgs.push(JSON.stringify(params)) result = window.liveapp[name](JSON.stringify(params))
} else {
result = window.liveapp[name]()
} }
const result = window.liveapp[name](...invokeArgs)
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