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); }
public void RegisterFunction(string FunctionName, NativeFunctionCallback Function) { SetGlobal(FunctionName, new Variable(new FunctionObject(Function))); }
public static unsafe extern NativeFunctionTemplateProxy *CreateFunctionTemplateProxy64(NativeV8EngineProxy *engine, string className, NativeFunctionCallback callback);
public static extern void SetCallAsFunctionHandler64(NativeObjectTemplateProxy *proxy, NativeFunctionCallback callback);
internal FunctionObject(NativeFunctionCallback Native) { _NativeCallback = Native; }