Properties

These are the 12 names you use inside attribute expressions. They all start with $. This keeps them from mixing with the scope's values.

$scope

The values of this h-scope itself. It points to the scope's values even when h-state or h-for hides them with the same name.

$el

The element the current expression is attached to.

$host

A handle on the scope element. $host.el is the scope element, $host.parent is the handle of the parent scope, and $host.parent.scope is the outer scope where the element sits. In function scope tools and component setup it is host. It is meant for debugging and workarounds, not as the recommended access. Receive outer values with h-inherit or h-inject. The old $root and $parent are gone ($root is now $host.el).

$host.seal() leaves the current screen as HTML and tears the scope down. Everything that followed values and every event bound by an attribute (@click, h-model) is removed, and inner scopes are sealed with it. Events a script bound directly stay. It cannot be undone. @scope:sealed is called just before sealing, and @scope:unmounted is not called. Read $host.sealed to see whether it is sealed.

A sealed element keeps no h-, @ or : attributes and no <template>. So use it to save a document filled in on screen as HTML without any front-end behavior — write the touch-ups only the saved copy needs with h-effect.sealed on each element, then read $host.el.outerHTML after sealing.

$props

Values received through h-props. They are read-only (all the way in). Assigning to one logs a console error and the value stays as it was. It does not throw. If you need a value you can change, copy it into the scope.

Components work the same way. Assigning to the name of a received prop logs a console error and leaves it as it was. The providing side is what changes it. The inside notifies with $emit.

$emit

Fires a DOM event that bubbles up. Ancestors receive it with @name.

$dispatch

Fires an event from the element you point to. It bubbles up.

$handle

Delivers an event only to the element you point to. It does not bubble.

$refs

Elements named with h-ref.

$nextTick

Runs after the screen has been updated.

$model

Reaches the h-model of the element you point to. get() reads the value. set(value) changes the value and updates that element on screen right away. It is null for an element without h-model.

$provide · $inject

A scope provides its values to descendants ($provide(key, value), or the provide tool in a function scope), and descendants inject them. It reaches any number of levels down, even fragments inserted later. To receive by name, use h-inject.

$async · $await

Runs an async task under a name and reads its state { status, value, promise }. Runs with the same name do not overlap. With { force: true }, the earlier run is cancelled.