public void raiseEndEvent(object[] args) { log.Trace("net.stream.raiseEndEvent()"); for (var i = 0; i < endCallbacks.Count; i++) { IronJS.FunctionObject func = (IronJS.FunctionObject)endCallbacks[i]; func.Call(this); } }
public void raiseDataEvent(object[] args) { string chunk = ( string )args[0]; log.Trace("net.stream.raiseDataEvent():" + chunk); for (var i = 0; i < dataCallbacks.Count; i++) { IronJS.FunctionObject func = (IronJS.FunctionObject)dataCallbacks[i]; func.Call <string>(this, chunk); } }
// TODO: pull this stuff out to an event class public void raiseListeningEvent(object[] args) { Console.WriteLine("http.server.raiseListeningEvent()"); for (var i = 0; i < listeningCallbacks.Count; i++) { // ( ( IronJS.FunctionObject )listeningCallbacks[i] ).Call( this, new object[]{} ); IronJS.FunctionObject func = (IronJS.FunctionObject)listeningCallbacks[i]; /* * Action<IronJS.FunctionObject,IronJS.CommonObject,object[]> fun = * func.Compiler.compileAs<Action<IronJS.FunctionObject,IronJS.CommonObject,object[]>>(func); * fun.Invoke(func, func.Env.Globals, new object[] {} ); */ func.Call(this, new BoxedValue[] { }); } }
public void raiseConnectionEventCont() { Console.WriteLine("raiseConnectionEventCont()"); foreach (object callback in connectionCallbacks) { // ( ( IFunction )callback ).Call( this, new object[] { req, resp } ); IronJS.FunctionObject func = (IronJS.FunctionObject)callback; /* * Action<IronJS.FunctionObject,IronJS.CommonObject,IronJS.CommonObject,IronJS.CommonObject> fun = * func.Compiler.compileAs<Action<IronJS.FunctionObject,IronJS.CommonObject,IronJS.CommonObject,IronJS.CommonObject>>(func); * fun.Invoke(func, this, req, resp ); */ func.Call <HttpServerRequest, HttpServerResponse>(this, req, resp); // func.Env.Globals for this? } }