Exemplo n.º 1
0
        public ScriptFunction(ScriptContext context, ScriptFunc func) : this(context)
        {
            if (func == null)
            {
                throw new ArgumentNullException(nameof(func));
            }

            this.func = func;
        }
Exemplo n.º 2
0
        public static JSValue ToJSValue(this ScriptFunc scriptFunc, JSContext context)
        {
            var functionObj = JSObjectMakeFunctionWithCallback(
                context.JSGlobalContextRefPtr,
                IntPtr.Zero,
                trampoline);

            functionDelegates [functionObj] = scriptFunc;

            return(JSValue.FromJSJSValueRef(functionObj, context));
        }