Added split combinator to actionObservable
This commit is contained in:
parent
935ca358e6
commit
c59d48f6ec
@ -1,6 +1,8 @@
|
||||
package nova.monadic_sfx.implicits
|
||||
|
||||
import monix.execution.Cancelable
|
||||
import monix.execution.Scheduler
|
||||
import monix.execution.cancelables.CompositeCancelable
|
||||
import monix.reactive.Observable
|
||||
import monix.reactive.Observer
|
||||
import monix.{eval => me}
|
||||
@ -40,8 +42,7 @@ class ActionObservableBuilder[A](
|
||||
|
||||
def underlying = observableAction
|
||||
|
||||
// def publish[B](f: Observable[A] => Observable[B]) =
|
||||
// new ActionObservableBuilder(observableAction.publishSelector(f))
|
||||
// Caution: Experimental stuff below..
|
||||
|
||||
def useEval2[B, C](f: A => me.Task[B], g: A => me.Task[C]) =
|
||||
new ActionObservableExecutor[(B, C)](
|
||||
@ -75,9 +76,23 @@ class ActionObservableBuilder[A](
|
||||
)
|
||||
.subscribe()
|
||||
|
||||
// def useEval2[B,C](a1: ActionObservableBuilder[A] => B, a2: ActionObservableBuilder[A] => C) = observableAction.publishSelector(conn =>
|
||||
// new ActionObservableBuilder[]
|
||||
// )
|
||||
}
|
||||
def split(
|
||||
lst: (ActionObservableBuilder[A] => Cancelable)*
|
||||
)(implicit s: Scheduler): Cancelable = {
|
||||
val comp = CompositeCancelable()
|
||||
comp += observableAction
|
||||
.publishSelector(conn =>
|
||||
Observable(
|
||||
lst.map(f =>
|
||||
Observable.unit.doOnNext(_ =>
|
||||
me.Task(
|
||||
comp += f(new ActionObservableBuilder[A](conn))
|
||||
) >> me.Task.unit
|
||||
)
|
||||
): _*
|
||||
).merge
|
||||
)
|
||||
.subscribe()
|
||||
}
|
||||
|
||||
// class MappedActionExecutor(actionMap: Map[])
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user