private Dom(EvaluationContext ctx) : base("websocket/dom") { var interp = (Interpreter)ctx; sink = interp.RPCSink; var gfo = sink.SendRPC(-1, "init", noArgs) as GraceForeignObject; var win = new DomObject((int)gfo.IdentifyingData, sink); AddMethod("window", new ConstantMethod(win)); //AddMethod("document", new ConstantMethod(new DomObject(1))); AddMethod("document", new DelegateMethod0Ctx(mDocument)); AddMethod("sleep(_)", new DelegateMethod1(mSleep)); AddMethod("run", new DelegateMethod0Ctx(mRun)); AddMethod("yield", new DelegateMethod0Ctx(mYield)); AddMethod("yieldFor(_)", new DelegateMethod1Ctx(mYieldFor)); AddMethod("end", new DelegateMethod0Ctx(mEnd)); AddMethod("ignoreResultOf(_) on(_)", new DelegateMethodReq(mIgnoreResultOf_On)); }
public DomObject(int k, RPCSink s) { key = k; sink = s; }