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
| Constant | Name | Dispatched from | Cancelable |
|---|---|---|---|
EVENTS.component.mounted | js-toolkit:component:mounted | the element, bubbling | no |
EVENTS.component.unmounted | js-toolkit:component:unmounted | document | no |
EVENTS.dom.update | js-toolkit:dom:update | the given node, bubbling | no |
EVENTS.diagnostic | js-toolkit:diagnostic | the element or document | yes |
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
$emitskey. They have no namespace: a component event isopen, notjs-toolkit:open. - A payload is one object in
CustomEvent.detail, or the platform valuenull. - 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.