2017-07-10 1 views
1

js-Code ist:So rufen Sie eine Referenzfunktion asynchron auf, von N-api kann ich nicht "env" bekommen!

const obj = tap.create(); 
quote.on("connection", (params) => { 
console.log('[DEBUG js]', 'connection called, params:', params); 
}); 

Funktion in c merken ++:

napi_create_reference(env, args[1], 1, &cbMap[eIt->second]); 

wenn native Funktion aufgerufen wird:

void TAP_CDECL Spi::OnConnect(int errorCode, const Info *info) { 

{{I want to call the function from cbMap here, How to write code? I do not 
known how to find "env"!}} 

} 

Antwort

0

Ich benutze Knoten-Addon-api das Problem lösen, jetzt Ich fand napi aktualisiert, von https://insight.io/github.com/nodejs/node/tree/master/test/addons-napi/test_env_sharing/, ich denke, es ist nützlich!

Verwandte Themen