public JSArray(ExecutionContext GLOBAL, Array args) { this.GLOBAL = GLOBAL; int idx = 0; foreach (object a in args) { this[idx] = new JSSimpleProperty(idx.ToString(), JSObject.ToJS(GLOBAL, a)); idx++; } MakeStdProperties(GLOBAL); }
public override object Construct(ExecutionContext GLOBAL, JSObjectBase args, ExecutionContext x) { object[] arglist = null; foreach (ConstructorInfo c in mThisType.GetConstructors()) { arglist = JSObject.SatisfyArgumentList(GLOBAL, args, c.GetParameters()); if (arglist != null) { return(JSObject.ToJS(GLOBAL, c.Invoke(arglist))); } } throw new TypeError("Wrong argument types for " + mThisType.Name + " constructor"); }
public void TriggerEvent(object sender, EventArgs args) { object senderOb = JSObject.ToJS(GLOBAL, sender), argsOb = JSObject.ToJS(GLOBAL, args); JSArray argArray = new JSArray(GLOBAL, new object[] { senderOb, argsOb }); foreach (object ob in mHookedUp) { JSObjectBase obBase = ob as JSObjectBase; if (obBase != null) { obBase.Call(GLOBAL, ob, argArray, GLOBAL.currentContext); } } }
public override object Call(ExecutionContext GLOBAL, object t, JSObjectBase a, ExecutionContext x) { Delegate d = mThisRef as Delegate; MethodInfo m = d.Method; if (d == null) { throw new TypeError(Class + " isn't callable"); } object[] arglist = JSObject.SatisfyArgumentList(GLOBAL, a, m.GetParameters()); if (arglist != null) { return(JSObject.ToJS(GLOBAL, d.DynamicInvoke(arglist))); } else { throw new TypeError("Wrong arguments for method " + m.DeclaringType.Name + "." + m.Name); } }
public object GetValue(ExecutionContext GLOBAL) { return(JSObject.ToJS(GLOBAL, mFieldInfo.GetValue(mThisRef))); }
public object GetValue(ExecutionContext GLOBAL) { return(JSObject.ToJS(GLOBAL, mPropertyInfo.GetValue(mThisRef, new object[] { }))); }