public Delegate CreateNewDelegate(Type targetDelegateType, JsFunction jsfunc) { DelegateHolder newHolder = this.holder.New(); newHolder.jsFunc = jsfunc; return(Delegate.CreateDelegate(targetDelegateType, newHolder, this.holder.InvokeMethodInfo)); }
private static void CheckAndResolveJsFunctions(Type type, string methodName, BindingFlags flags, object[] args) { MethodInfo mi = type.GetMethod(methodName, flags); ParameterInfo[] paramTypes = mi.GetParameters(); for (int i = Math.Min(paramTypes.Length, args.Length) - 1; i >= 0; --i) { if (args[i] != null && args[i].GetType() == typeof(JsFunction)) { JsFunction function = (JsFunction)args[i]; args[i] = function.MakeDelegate(paramTypes[i].ParameterType); } } }