Exemple #1
0
 public void transition(EventEmitter ev, string success, params object[] data)
 {
     this.transition(ev, success, "error", data);
 }
Exemple #2
0
        public void transition(EventEmitter ev, string success, string error, params object[] data)
        {
            ev.addListener("success", delegate(object[] p) { this.transitionTo(success, p); });
            ev.addListener("error", delegate(object[] p) { this.transitionTo(error, p); });

            if (typeof (StateMachine) == ev.GetType()) {
                (ev as StateMachine).start();
            }
        }
Exemple #3
0
        protected override void _Spec()
        {
            // Spec tests!
            this._addSpec("addListener", delegate(Spec.SpecDone done)
            {
                EventEmitter self = new EventEmitter();
                self.addListener("test", delegate(object[] p) {});
                done(self.events.Count > 0);
            });

            this._addSpec("emit", delegate(Spec.SpecDone done)
            {
                EventEmitter self = new EventEmitter();
                self.addListener("test", delegate(object[] p)
                {
                    done(true);
                });
                self.emit("test");
            });

            this._addSpec("emit with params", delegate(Spec.SpecDone done)
            {
                EventEmitter self = new EventEmitter();
                self.addListener("test", delegate(object[] p)
                {
                    bool match = (p.Length == 3 && (int)p[0] == 1 && (int)p[1] == 2 && (int)p[2] == 3);
                    done(match);
                });
                self.emit("test", 1, 2, 3);
            });
        }