com.raquo.laminar.modifiers

Type members

Classlikes

trait Binder[-El <: Base] extends Modifier[El]

Binder is a Modifier that creates a subscription when invoked.

Binder is a Modifier that creates a subscription when invoked.

  • Note, this Modifier is NOT idempotent: Calling it N times will create and bind N subscriptions
  • onMountBind can take care of this, see the docs
Companion:
object
object Binder
Companion:
class

Note: this is a low level inserter. It is the fastest one, but due to its rather imperative API, its usefulness is very limited. It's good for simple but voluminous stuff, like appending new log items to a big list, but not much else.

Note: this is a low level inserter. It is the fastest one, but due to its rather imperative API, its usefulness is very limited. It's good for simple but voluminous stuff, like appending new log items to a big list, but not much else.

Consider using children <-- observable.split(...) instead, it has great performance and is much more convenient.

class CompositeKeySetter[K <: Key, -El <: Base](val key: CompositeKey[K, El], val itemsToAdd: List[String], val itemsToRemove: List[String]) extends Setter[El]

This is like KeySetter, but for composite attributes like cls and role.

This is like KeySetter, but for composite attributes like cls and role.

CompositeKeySetter can not be a subtype of KeySetter because we can not implement val value – the actual value to be set is dynamic, depending on the current value of the element's composite attribute.

Note: for dynamic subscriptions (<--), we use KeyUpdater for all keys including composite attributes.

class EventListener[Ev <: Event, Out](val eventProcessor: EventProcessor[Ev, Out], val callback: Out => Unit) extends Binder[Base]
Companion:
object
Companion:
class
class Inserter[-El <: Base](initialContext: Option[InsertContext[El]], preferStrictMode: Boolean, insertFn: (InsertContext[El], Owner) => Subscription) extends Modifier[El]

Inserter is a modifier that lets you insert child node(s) on mount. When used with onMountInsert, it "immediately" reserves an insertion spot and then on every mount it inserts the node(s) into the same spot.

Inserter is a modifier that lets you insert child node(s) on mount. When used with onMountInsert, it "immediately" reserves an insertion spot and then on every mount it inserts the node(s) into the same spot.

Note: As a Modifier this is not idempotent, but overall it behaves as you would expect. See docs for more details.

Note: If you DO provide initialContext, its parentNode MUST always be the same element that you apply this Modifier to.

class KeySetter[K <: Key, V, -El <: Base](val key: K, val value: V, val action: (El, K, V) => Unit) extends Setter[El]

This class represents a modifier that sets a Key (e.g. an attribute or a style) to a specific value on a El. action is what performs this change.

This class represents a modifier that sets a Key (e.g. an attribute or a style) to a specific value on a El. action is what performs this change.

Companion:
object
object KeySetter
Companion:
class
class KeyUpdater[-El <: Base, +K <: Key, V](val key: K, val values: Observable[V], val update: (El, V, Any) => Unit) extends Binder[El]

A modifier that updates a key from a source, e.g. value <-- valueStream

A modifier that updates a key from a source, e.g. value <-- valueStream

Value parameters:
update

(element, newValue, reason) => () The reason is used for updating CompositeKey-s.

Companion:
object
object KeyUpdater
Companion:
class
trait Modifier[-El <: Base]

This type represents an operation that has a side effect on a node of type El.

This type represents an operation that has a side effect on a node of type El.

For example: attrs.href := "http://example.com" is a Modifier that sets the href attribute to an example URL when invoked on an element (typically when the element is mounted, or if the modifier is added after the fact using the amend method, or by manually calling its apply method).

We're defining a specific trait for this because we expect to have implicit conversions into this type.

Companion:
object
object Modifier
Companion:
class
trait Renderable[A]
Companion:
object
object Renderable
Companion:
class
trait Setter[-El <: Base] extends Modifier[El]

This type represents a modifier that sets a "property" of an element.

This type represents a modifier that sets a "property" of an element.

It could be an html attribute, an event prop, or even a custom focus prop, the main constraint is that it should be idempotent, so that applying it several times in a row would produce the same effect as applying it once.

That way we can provide it to onMountSet { c => setter } and expect things to work if the element is mounted several times.

Companion:
object
object Setter
Companion:
class