Skip to content

Commit

Permalink
Support converting a Watchable to a BindingSeq
Browse files Browse the repository at this point in the history
Atry committed Nov 6, 2021
1 parent c3e5041 commit 7e6f3aa
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -99,7 +99,7 @@ package bindable {
def toBinding(from: From): Binding[Value]
}

private[bindable] trait LowPriorityBindableSeq2 {
private[bindable] trait LowPriorityBindableSeq3 {
@deprecated("Potential naming conflict with `Bindable.constantBindable`.", "1.0.2")
private[bindable] def constantBindable[Value] = constantsBindableSeq[Value]

@@ -109,6 +109,21 @@ package bindable {
}
}

private[bindable] trait LowPriorityBindableSeq2 extends LowPriorityBindableSeq3 {
implicit def watchableBindableSeq[Value0]: BindableSeq.Aux[Watchable[Value0], Value0] =
new BindableSeq[Watchable[Value0]] {
type Value = Value0
def toBindingSeq(from: Watchable[Value]): BindingSeq[Value] = {
from match {
case binding: Binding[Value] =>
SingletonBindingSeq(binding)
case bindingSeq: BindingSeq[Value] =>
bindingSeq
}
}
}
}

private[bindable] trait LowPriorityBindableSeq1 extends LowPriorityJsBindableSeq2 {
implicit def bindingBindableSeq[Value0]: BindableSeq.Aux[Binding[Value0], Value0] =
new BindableSeq[Binding[Value0]] {

0 comments on commit 7e6f3aa

Please sign in to comment.