Example #1
0
 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);
     }
 }
Example #2
0
        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);
            }
        }
Example #3
0
        // 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[] { });
            }
        }
Example #4
0
        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?
            }
        }