Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
 public static NodeJsExternalBuffer CreateExternalBuffer(this NapiEnv env, MyNativeMemBuffer memBuffer)
 {
     //we must handle the native buffer properly!!!
     return(env.CreateExternalBuffer(memBuffer.Ptr, memBuffer.Length));
 }