예제 #1
0
        public void register <Obj, A>(string name, HasObjFn <Obj> objOpt, Fn <Obj, Future <A> > run)
        {
            var prefixedName = $"[DC|{commandGroup}]> {name}";

            console.register(new DConsole.Command(commandGroup, name, () => {
                var opt = objOpt();
                if (opt.isDefined)
                {
                    var returnFuture   = run(opt.get);
                    Act <A> onComplete = t => Debug.Log($"{prefixedName} done: {t}");
                    // Check perhaps it is completed immediately.
                    returnFuture.value.voidFold(
                        () => {
                        Debug.Log($"{prefixedName} starting.");
                        returnFuture.onComplete(onComplete);
                    },
                        onComplete
                        );
                }
                else
                {
                    Debug.Log($"{prefixedName} not running: {typeof(Obj)} is None.");
                }
            }));
        }
예제 #2
0
 public void register <Obj, A>(string name, HasObjFn <Obj> objOpt, Fn <Obj, A> run)
 {
     register(name, objOpt, obj => Future.successful(run(obj)));
 }
예제 #3
0
 public ISubscription register <Obj, A>(string name, HasObjFn <Obj> objOpt, Fn <Obj, A> run) =>
 register(name, objOpt, obj => Future.successful(run(obj)));
예제 #4
0
 public void register <Obj>(string name, HasObjFn <Obj> objOpt, Act <Obj> run)
 {
     register(name, objOpt, obj => { run(obj); return(F.unit); });
 }
예제 #5
0
 public ISubscription register <Obj>(string name, HasObjFn <Obj> objOpt, Act <Obj> run) =>
 register(name, objOpt, obj => { run(obj); return(F.unit); });