trait BindableSeq[-From] extends Serializable
A dependent type class that witnesses a type that can be converted to a BindingSeq[Value]
.
- Source
- package.scala
The bindSeq can be enabled by the following
import
statement:import com.thoughtworks.binding.bindable._
Then, a
@dom
XHTML template can establish data-binding on anyparameter
as long as a BindableSeq type class for theparameter
type is available.import org.scalajs.dom.raw._ @dom def mySection[A: BindableSeq.Lt[?, Node]](parameter: A) = { <section>{parameter.bindSeq}</section> }
Note that the
?
syntax requires the Scala plug-in kind-projector, which can be enabled by adding the following setting into yourbuild.sbt
:addCompilerPlugin("org.typelevel" %% "kind-projector" % "0.10.3")
ThemySection
method accepts any parameter who is a subtype ofBinding[Node]
orBinding[BindingSeq[Node]]
.import com.thoughtworks.binding._, Binding._ @dom def myButton: Binding[HTMLButtonElement] = <button type="button">My Button 0</button> @dom def myButtons: Binding[BindingSeq[Node]] = <button type="button">My Button 1</button><button type="button">My Button 2</button> Binding { mySection(myButton).bind.innerHTML should be("") mySection(myButtons).bind.innerHTML should be("") }.watch()
And the
mySection
method also acceptsNode
,BindingSeq[Node]
,List[Node]
,Array[Node]
,js.Array[Node]
, orBinding[js.Array[Node]]
parameter.import scala.scalajs.js @dom def test = { mySection(<button type="button">My Button 3</button>).bind.innerHTML should be("") mySection(<button type="button">My Button 4</button><button type="button">My Button 5</button>).bind.innerHTML should be( "" ) mySection(List(<button type="button">My Button 6</button>, <button type="button">My Button 7</button>)).bind.innerHTML should be("") mySection(Array(<button type="button">My Button 8</button>, <button type="button">My Button 9</button>)).bind.innerHTML should be("") mySection(js.Array(<button type="button">My Button 10</button>, <button type="button">My Button 11</button>)).bind.innerHTML should be("") mySection(Constant(js.Array(<button type="button">My Button 12</button>, <button type="button">My Button 13</button>))).bind.innerHTML should be("") } test.watch()
mySection
should not accept irrelevant parameter types like scala.collection.immutable.Set or scala.Int."mySection(Set.empty)" shouldNot compile "mySection(42)" shouldNot compile
- Alphabetic
- By Inheritance
- BindableSeq
- Serializable
- Serializable
- Any
- by bindableToBinding
- by toBindableSeqOps
- by toBindableOps
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Type Members
- abstract type Value
Abstract Value Members
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
##(): Int
- Definition Classes
- Any
-
def
+(other: String): String
- Implicit
- This member is added by an implicit conversion from BindableSeq[From] to any2stringadd[BindableSeq[From]] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
-
def
->[B](y: B): (BindableSeq[From], B)
- Implicit
- This member is added by an implicit conversion from BindableSeq[From] to ArrowAssoc[BindableSeq[From]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
final macro
def
bind: Value
- Implicit
- This member is added by an implicit conversion from BindableSeq[From] to Binding[Value] performed by method bindableToBinding in com.thoughtworks.binding.bindable. This conversion will take place only if an implicit value of type Lt[BindableSeq[From], Value] is in scope.
- Definition Classes
- Binding
-
def
bindSeq: BindingSeq[Value]
- Implicit
- This member is added by an implicit conversion from BindableSeq[From] to Ops[BindableSeq[From]] { type TypeClassType = com.thoughtworks.binding.bindable.BindableSeq[com.thoughtworks.binding.bindable.BindableSeq[From]]{type Value = tc.Value} } performed by method toBindableSeqOps in com.thoughtworks.binding.bindable.BindableSeq.ToBindableSeqOps. This conversion will take place only if an implicit value of type BindableSeq[BindableSeq[From]] is in scope.
- Definition Classes
- Ops
-
def
ensuring(cond: (BindableSeq[From]) ⇒ Boolean, msg: ⇒ Any): BindableSeq[From]
- Implicit
- This member is added by an implicit conversion from BindableSeq[From] to Ensuring[BindableSeq[From]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: (BindableSeq[From]) ⇒ Boolean): BindableSeq[From]
- Implicit
- This member is added by an implicit conversion from BindableSeq[From] to Ensuring[BindableSeq[From]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean, msg: ⇒ Any): BindableSeq[From]
- Implicit
- This member is added by an implicit conversion from BindableSeq[From] to Ensuring[BindableSeq[From]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean): BindableSeq[From]
- Implicit
- This member is added by an implicit conversion from BindableSeq[From] to Ensuring[BindableSeq[From]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
equals(arg0: Any): Boolean
- Definition Classes
- Any
-
def
formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from BindableSeq[From] to StringFormat[BindableSeq[From]] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @inline()
-
def
hashCode(): Int
- Definition Classes
- Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
toBinding: Binding[Bindable.Value]
- Implicit
- This member is added by an implicit conversion from BindableSeq[From] to Ops[BindableSeq[From]] { type TypeClassType = com.thoughtworks.binding.bindable.Bindable[com.thoughtworks.binding.bindable.BindableSeq[From]]{type Value = tc.Value} } performed by method toBindableOps in com.thoughtworks.binding.bindable.Bindable.ToBindableOps. This conversion will take place only if an implicit value of type Bindable[BindableSeq[From]] is in scope.
- Definition Classes
- Ops
-
def
toString(): String
- Definition Classes
- Any
-
final
def
unwatch(): Unit
- Implicit
- This member is added by an implicit conversion from BindableSeq[From] to Binding[Value] performed by method bindableToBinding in com.thoughtworks.binding.bindable. This conversion will take place only if an implicit value of type Lt[BindableSeq[From], Value] is in scope.
- Definition Classes
- Binding
- Annotations
- @inline()
-
final
def
watch(): Unit
- Implicit
- This member is added by an implicit conversion from BindableSeq[From] to Binding[Value] performed by method bindableToBinding in com.thoughtworks.binding.bindable. This conversion will take place only if an implicit value of type Lt[BindableSeq[From], Value] is in scope.
- Definition Classes
- Binding
- Annotations
- @inline()
-
def
→[B](y: B): (BindableSeq[From], B)
- Implicit
- This member is added by an implicit conversion from BindableSeq[From] to ArrowAssoc[BindableSeq[From]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
Shadowed Implicit Value Members
-
def
self: BindableSeq[From]
- Implicit
- This member is added by an implicit conversion from BindableSeq[From] to Ops[BindableSeq[From]] { type TypeClassType = com.thoughtworks.binding.bindable.BindableSeq[com.thoughtworks.binding.bindable.BindableSeq[From]]{type Value = tc.Value} } performed by method toBindableSeqOps in com.thoughtworks.binding.bindable.BindableSeq.ToBindableSeqOps. This conversion will take place only if an implicit value of type BindableSeq[BindableSeq[From]] is in scope.
- Shadowing
- This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
To access this member you can use a type ascription:(bindableSeq: Ops[BindableSeq[From]] { type TypeClassType = com.thoughtworks.binding.bindable.BindableSeq[com.thoughtworks.binding.bindable.BindableSeq[From]]{type Value = tc.Value} }).self
- Definition Classes
- Ops
-
def
self: BindableSeq[From]
- Implicit
- This member is added by an implicit conversion from BindableSeq[From] to Ops[BindableSeq[From]] { type TypeClassType = com.thoughtworks.binding.bindable.Bindable[com.thoughtworks.binding.bindable.BindableSeq[From]]{type Value = tc.Value} } performed by method toBindableOps in com.thoughtworks.binding.bindable.Bindable.ToBindableOps. This conversion will take place only if an implicit value of type Bindable[BindableSeq[From]] is in scope.
- Shadowing
- This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
To access this member you can use a type ascription:(bindableSeq: Ops[BindableSeq[From]] { type TypeClassType = com.thoughtworks.binding.bindable.Bindable[com.thoughtworks.binding.bindable.BindableSeq[From]]{type Value = tc.Value} }).self
- Definition Classes
- Ops
-
def
toBindingSeq: BindingSeq[Value]
- Implicit
- This member is added by an implicit conversion from BindableSeq[From] to Ops[BindableSeq[From]] { type TypeClassType = com.thoughtworks.binding.bindable.BindableSeq[com.thoughtworks.binding.bindable.BindableSeq[From]]{type Value = tc.Value} } performed by method toBindableSeqOps in com.thoughtworks.binding.bindable.BindableSeq.ToBindableSeqOps. This conversion will take place only if an implicit value of type BindableSeq[BindableSeq[From]] is in scope.
- Shadowing
- This implicitly inherited member is shadowed by one or more members in this class.
To access this member you can use a type ascription:(bindableSeq: Ops[BindableSeq[From]] { type TypeClassType = com.thoughtworks.binding.bindable.BindableSeq[com.thoughtworks.binding.bindable.BindableSeq[From]]{type Value = tc.Value} }).toBindingSeq
- Definition Classes
- Ops
-
val
typeClassInstance: BindableSeq[BindableSeq[From]] { type Value = tc.Value }
- Implicit
- This member is added by an implicit conversion from BindableSeq[From] to Ops[BindableSeq[From]] { type TypeClassType = com.thoughtworks.binding.bindable.BindableSeq[com.thoughtworks.binding.bindable.BindableSeq[From]]{type Value = tc.Value} } performed by method toBindableSeqOps in com.thoughtworks.binding.bindable.BindableSeq.ToBindableSeqOps. This conversion will take place only if an implicit value of type BindableSeq[BindableSeq[From]] is in scope.
- Shadowing
- This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
To access this member you can use a type ascription:(bindableSeq: Ops[BindableSeq[From]] { type TypeClassType = com.thoughtworks.binding.bindable.BindableSeq[com.thoughtworks.binding.bindable.BindableSeq[From]]{type Value = tc.Value} }).typeClassInstance
- Definition Classes
- Ops
-
val
typeClassInstance: Bindable[BindableSeq[From]] { type Value = tc.Value }
- Implicit
- This member is added by an implicit conversion from BindableSeq[From] to Ops[BindableSeq[From]] { type TypeClassType = com.thoughtworks.binding.bindable.Bindable[com.thoughtworks.binding.bindable.BindableSeq[From]]{type Value = tc.Value} } performed by method toBindableOps in com.thoughtworks.binding.bindable.Bindable.ToBindableOps. This conversion will take place only if an implicit value of type Bindable[BindableSeq[From]] is in scope.
- Shadowing
- This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
To access this member you can use a type ascription:(bindableSeq: Ops[BindableSeq[From]] { type TypeClassType = com.thoughtworks.binding.bindable.Bindable[com.thoughtworks.binding.bindable.BindableSeq[From]]{type Value = tc.Value} }).typeClassInstance
- Definition Classes
- Ops
Deprecated Value Members
-
final macro
def
each: Value
- Implicit
- This member is added by an implicit conversion from BindableSeq[From] to Binding[Value] performed by method bindableToBinding in com.thoughtworks.binding.bindable. This conversion will take place only if an implicit value of type Lt[BindableSeq[From], Value] is in scope.
- Definition Classes
- Binding
- Annotations
- @deprecated
- Deprecated
(Since version 7.0.0) Use bind instead