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."); } })); }
public void register <Obj, A>(string name, HasObjFn <Obj> objOpt, Fn <Obj, A> run) { register(name, objOpt, obj => Future.successful(run(obj))); }
public ISubscription register <Obj, A>(string name, HasObjFn <Obj> objOpt, Fn <Obj, A> run) => register(name, objOpt, obj => Future.successful(run(obj)));
public void register <Obj>(string name, HasObjFn <Obj> objOpt, Act <Obj> run) { register(name, objOpt, obj => { run(obj); return(F.unit); }); }
public ISubscription register <Obj>(string name, HasObjFn <Obj> objOpt, Act <Obj> run) => register(name, objOpt, obj => { run(obj); return(F.unit); });