public CallMemberFunction ( string functionName ) : object | ||
functionName | string | The name of the function to call. |
return | object |
public object CallMemberFunction(string functionName, params object[] parameters)
{
var function = GetPropertyValue(functionName);
if (function == null)
throw new JavaScriptException(this.Engine, ErrorType.TypeError, string.Format("Object {0} has no method '{1}'", this.ToString(), functionName));
if ((function is FunctionInstance) == false)
throw new JavaScriptException(this.Engine, ErrorType.TypeError, string.Format("Property '{1}' of object {0} is not a function", this.ToString(), functionName));
return ((FunctionInstance)function).CallLateBound(this, parameters);
}
public static object ToJSON(ObjectInstance thisObject, string key) { var number = TypeConverter.ToPrimitive(thisObject, PrimitiveTypeHint.Number); if (number is double && (double.IsInfinity((double)number) || double.IsNaN((double)number))) return Null.Value; return thisObject.CallMemberFunction("toISOString"); }