同事,我不能让diode
从另一个动作发送自己的多个动作。这里是App circuit
的例子:
val handler = new ActionHandler(myZoomedState) {
override def handle = {
case action => effectOnly(Effect(someFuture map {_ =>
someAction //This action doesn't perform
someOtherAction //This one does
}))
case someAction => ???
case someOtherAction => ???
}
}
如何连锁我的行动?像>>
whith callbacks
这样的东西:
someCallback >> someOtherCallback
答案 0 :(得分:0)
someAction
和someOtherAction
的处理程序实际上仅作为case action
的实施建议,则可以将它们移动到命名方法中并使用<<
or >>
or +
进行组合。如果这不是你想要的,你应该详细说明你的问题。
答案 1 :(得分:0)
解决方案是创建另一个动作,结合这两个动作。我仍然可以处理Future
错误。看起来像这样:
case object DoSmthStuff
...
val handler = new ActionHandler(myZoomedState) {
override def handle = {
case action => effectOnly(Effect(
someFuture map { _ => DoSmthStuff } recover { ... }
))
case DoSmthStuff = effectOnly(
Effect.action(someAction) >> Effect.action(someOtherAction)
)
case someAction => ???
case someOtherAction => ???
}
}