Capability first · transport second

WaitForComponent.js

Waits for a component property, method, or readiness event with optional error event and bounded timeout.

SDK 0.5.18Runtime 0.8.12Protocol arcane/1
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

JavaScript
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

BindingFormDeclaration or signatureParameter syntax
COMPONENT_WAIT_ERROR_CODESvariable · valuevariable COMPONENT_WAIT_ERROR_CODES
COMPONENT_WAIT_REASONSvariable · valuevariable COMPONENT_WAIT_REASONS
defaultdefault · functionfunction waitForComponent(element,options={})element,options={}
CallableKindExact public signatureParameter syntax
defaultexported-functionfunction 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

JavaScript
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();

No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.