Ejemplo n.º 1
0
        NativeFunctionCallback _ProxyCallback; // (need to keep a reference)

        /// <summary>
        ///     Registers an invoke handler on the underlying native ObjectTemplate instance, which allows objects to be called like
        ///     a function.
        ///     <para>A proxy delegate is used and stored locally to prevent it from being reclaimed by the
        ///     GC. If you call this method again, the old proxy delegate will be replaced with a new one and registered again on
        ///     the native side. </para>
        /// </summary>
        /// <param name="callback"> A callback that gets invoked when the object is used like a function. </param>
        public void SetCallAsFunctionHandler(JSFunction callback)
        {
            _ProxyCallback = (managedObjectID, isConstructCall, _this, args, argCount) =>
            {
                return(FunctionTemplate._CallBack(managedObjectID, isConstructCall, _this, args, argCount, callback));
            };
            V8NetProxy.SetCallAsFunctionHandler(_NativeObjectTemplateProxy, _ProxyCallback);
        }
Ejemplo n.º 2
0
 public void RegisterFunction(string FunctionName, NativeFunctionCallback Function)
 {
     SetGlobal(FunctionName, new Variable(new FunctionObject(Function)));
 }
Ejemplo n.º 3
0
 public static unsafe extern NativeFunctionTemplateProxy *CreateFunctionTemplateProxy64(NativeV8EngineProxy *engine, string className, NativeFunctionCallback callback);
Ejemplo n.º 4
0
 public static extern void SetCallAsFunctionHandler64(NativeObjectTemplateProxy *proxy, NativeFunctionCallback callback);
Ejemplo n.º 5
0
 internal FunctionObject(NativeFunctionCallback Native)
 {
     _NativeCallback = Native;
 }