Espresso.NativeV8JsInterOp.CreateNativePart C# (CSharp) Method

CreateNativePart() public static method

public static CreateNativePart ( Espresso.JsContext context, INativeScriptable proxyObj ) : void
context Espresso.JsContext
proxyObj INativeScriptable
return void
        public static void CreateNativePart(JsContext context, INativeScriptable proxyObj)
        {
            if (!proxyObj.HasNativeSide)
            {
                proxyObj.SetUnmanagedPtr(
                    CreateWrapperForManagedObject(
                        context.Handle.Handle,
                        proxyObj.ManagedIndex,
                        proxyObj.UnmanagedTypeDefinitionPtr));
            }
        }
        public static void UnRegisterNativePart(INativeRef proxyObj)

Usage Example

示例#1
0
        public NativeJsInstanceProxy CreateProxyForObject(object o, JsTypeDefinition jsTypeDefinition)
        {
            if (_createdWrappers.TryGetValue(o, out NativeJsInstanceProxy found))
            {
                return(found);
            }

            var proxyObject = new NativeJsInstanceProxy(
                _nativeRefList.Count,
                o,
                jsTypeDefinition);

            _nativeRefList.Add(proxyObject);
            _createdWrappers.Add(o, proxyObject);

            //register
            NativeV8JsInterOp.CreateNativePart(_ownerContext, proxyObject);
            return(proxyObject);
        }