You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm still developing the js_native_api.go to allow for this use-case, but it's not there just yet. Ultimately you'd need to make use of the napi_call_function / napi.CallFunction API to do this.
This isn't finalized, but the Go portion would look a little something like this once that's added:
funcFuncCallback(env napi.Env, info napi.CallbackInfo) napi.Value {
callbackInfo, _:=napi.GetCbInfo(env, info)
jsCallback:=callbackInfo.Args[0]
fromGoObj, _:=napi.CreateObject(env)
globalValue, _:=napi.GetGlobal(env)
// this napi.CallFunction API does not exist yet:napi.CallFunction(env, globalValue, jsCallback, []napi.Value{fromGoObj})
}
// func CallFunction(env napi.Env, recv napi.Value, args []napi.Value) (napi.Value, napi.Status)
i want to use like this:
js code:
let gomodule=require("./gomod.node");
gomodule.func(
function( fromGoObj){
console.info(fromGoObj)
}
);
then how can i write go code?
Your project has been very helpful to me. Thank you very much
The text was updated successfully, but these errors were encountered: