On this page
Overview
Waits for a component property, method, or readiness event with optional error event and bounded timeout.
- Artifact
WaitForComponent.js· esm - Classification
public first party - Availability
Cross-host EventTarget / browser component - Normalization
Normalized coded readiness, error, and timeout results.
Import and lifecycle
import * as module from '/arcane/modules/WaitForComponent.js';
Attaches configured readiness/error listeners and an optional timer no longer than 60 seconds, then removes all of them on resolution/rejection. Immediate-ready paths clean up synchronously.
Application-facing behavior: default waitForComponent().
Protocol and host implementation
EventTarget + timers This detail does not widen the application-facing API or grant authority.
Exports, signatures, parameters, and results
| Binding | Form | Declaration or signature | Parameter syntax |
|---|---|---|---|
COMPONENT_WAIT_ERROR_CODES | variable · value | variable COMPONENT_WAIT_ERROR_CODES | — |
COMPONENT_WAIT_REASONS | variable · value | variable COMPONENT_WAIT_REASONS | — |
default | default · function | function waitForComponent(element,options={}) | element,options={} |
| Callable | Kind | Exact public signature | Parameter syntax |
|---|---|---|---|
default | exported-function | function waitForComponent(element,options={}) | element,options={} |
Parameter meanings and results
waitForComponent(element,{property='',methods=[],event='',errorEvent='',timeoutMs=0}) resolves the element. Readiness requires property===true when named and every named method callable.
Events, side effects, and errors
Source-literal CustomEvent dispatches
No source-literal CustomEvent dispatch is part of this artifact.
Lifecycle and event flow
- Consumes the caller-named readiness event and optional error event.
Direct coded failures
This artifact directly assigns no stable coded failure.
Exported Error subclasses
This artifact exports no Error subclass.
Documented failure behavior
- RangeError for timeout outside 0–60000.
- COMPONENT_READY_FAILED
- COMPONENT_READY_TIMEOUT
- Uncoded missing-element or missing-readiness-event Error.
Availability and capabilities
Cross-host EventTarget / browser component. Normalized coded readiness, error, and timeout results.
None.
Contract example
import waitForComponent from '/arcane/modules/WaitForComponent.js';
const widget = document.querySelector('arcane-widget');
await waitForComponent(widget,{
property:'ready',
methods:['refresh'],
event:'widget-ready',
errorEvent:'widget-error',
timeoutMs:5000
});
widget.refresh();
Related reference
No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.