Inserter

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.

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.

trait Modifier[El]
class Object
trait Matchable
class Any

Value members

Concrete methods

override def apply(element: El): Unit

You can count on this method being a no-op in your libraries and end user code.

You can count on this method being a no-op in your libraries and end user code.

The reason this method is not abstract is to avoid broken SAM sugar in case of meta modifiers. See https://github.com/raquo/scala-dom-types/issues/27

Definition Classes
def bind(element: El): DynamicSubscription
def withContext(context: InsertContext[El]): Inserter[El]

Call this to get a copy of Inserter with a context locked to a certain element. We use this to "reserve a spot" for future nodes when a bind(c => inserter) modifier is initialized, as opposed to waiting until subscription is activated.

Call this to get a copy of Inserter with a context locked to a certain element. We use this to "reserve a spot" for future nodes when a bind(c => inserter) modifier is initialized, as opposed to waiting until subscription is activated.

The arrangement is admittedly a bit weird, but is required to build a smooth end user API.