public object CallFunction(JsObject function, params object[] arguments) { if (function == null) throw new ArgumentNullException("function"); object[] argumentsCopy; if (arguments == null || arguments.Length == 0) { argumentsCopy = JsValue.EmptyArray; } else { argumentsCopy = new object[arguments.Length]; for (int i = 0; i < arguments.Length; i++) { argumentsCopy[i] = Global.Marshaller.MarshalClrValue(arguments[i]); } } var original = new object[argumentsCopy.Length]; Array.Copy(argumentsCopy, original, argumentsCopy.Length); var result = function.Execute(_runtime, JsNull.Instance, argumentsCopy); for (int i = 0; i < arguments.Length; i++) { arguments[i] = Global.Marshaller.MarshalJsValue<object>(argumentsCopy[i]); } return Global.Marshaller.MarshalJsValue<object>(result); }
public object ExecuteFunction(JsObject function, object that, object[] arguments) { if (function == null) throw new ArgumentNullException("function"); return function.Execute(_runtime, that, arguments); }