fix(lib/modules/native): await callable method properly
This commit is contained in:
parent
420f3e803e
commit
27c445e196
1 changed files with 6 additions and 1 deletions
|
|
@ -133,7 +133,12 @@ function _wrapJSMethod(method: AnyFunction) {
|
|||
return (...args: any[]) => {
|
||||
try {
|
||||
const ret = method(...args)
|
||||
_returnJSCall({ result: ret ?? null })
|
||||
if (ret instanceof Promise)
|
||||
ret.then(
|
||||
result => _returnJSCall({ result: result ?? null }),
|
||||
error => _returnJSCall({ error: getErrorStack(error) }),
|
||||
)
|
||||
else _returnJSCall({ result: ret ?? null })
|
||||
} catch (error) {
|
||||
_returnJSCall({ error: getErrorStack(error) })
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue