public NodeJsApi.NapiEnv GetJsNodeNapiEnv() { if (_nodeJsNapiEnv != null) { return(_nodeJsNapiEnv); } JsValue nativeContext = new JsValue(); js_new_napi_env(this.NativeContextHandle, ref nativeContext); if (nativeContext.Type == JsValueType.Wrapped) { //OK return(_nodeJsNapiEnv = new NodeJsApi.NapiEnv(nativeContext.Ptr)); } else { return(null); } }
public static NodeJsExternalBuffer CreateExternalBuffer(this NapiEnv env, MyNativeMemBuffer memBuffer) { //we must handle the native buffer properly!!! return(env.CreateExternalBuffer(memBuffer.Ptr, memBuffer.Length)); }