Skip to content

EVENTS

A deeply frozen object of the events the framework itself dispatches, all namespaced js-toolkit:.

js
import { 
EVENTS
} from '@studiometa/js-toolkit';
EVENTS
.
component
.
mounted
; // 'js-toolkit:component:mounted'
EVENTS
.
component
.
unmounted
; // 'js-toolkit:component:unmounted'
EVENTS
.
dom
.
update
; // 'js-toolkit:dom:update'
EVENTS
.
diagnostic
; // 'js-toolkit:diagnostic'

The events

ConstantNameDispatched fromCancelable
EVENTS.component.mountedjs-toolkit:component:mountedthe element, bubblingno
EVENTS.component.unmountedjs-toolkit:component:unmounteddocumentno
EVENTS.dom.updatejs-toolkit:dom:updatethe given node, bubblingno
EVENTS.diagnosticjs-toolkit:diagnosticthe element or documentyes

See Instance events for the lifecycle pair, domUpdate() for the update event, and Diagnostics for the diagnostic.

The convention

  • Public framework events use this object and the js-toolkit: namespace.
  • Private framework transports use module-local namespaced constants and do not join EVENTS — the context request is one.
  • Component events are typed lower-kebab string literals declared through the props type's $emits key. They have no namespace: a component event is open, not js-toolkit:open.
  • A payload is one object in CustomEvent.detail, or the platform value null.
  • Diagnostic events are cancelable, so monitoring can suppress the default output only.

Only what a consumer can usefully listen to is exported. That is the whole rule for whether something belongs here.

Import it on its own

js
import { 
EVENTS
} from '@studiometa/js-toolkit/EVENTS';

The generated subpath keeps the frozen object importable without the root barrel — which matters on a page with no build step, where a barrel import downloads the barrel's whole graph.

EVENTS.error is removed

With no alias. EVENTS.error, ToolkitErrorDetail and ToolkitErrorStage are gone; EVENTS.diagnostic and the DIAGNOSTICS codes replace them.

MIT Licensed