DOM

connectRuntimeToDOM

Subscribe an existing core runtime to a DOMAnnouncer while preserving separate runtime and browser ownership.

Signature and import

connectRuntimeToDOM borrows your runtime. Disposing its binding removes only subscription and announcer resources.

typescript
import { createGenerativeA11y } from "@generative-a11y/core";
import { connectRuntimeToDOM } from "@generative-a11y/dom";

const runtime = createGenerativeA11y({});
const delivery = connectRuntimeToDOM(runtime, { mode: "auto" });

runtime.dispatch(event);

delivery.dispose();
runtime.dispose();

How this code works

  1. 01
    Create the runtime

    Your app creates and owns the core runtime.

  2. 02
    Connect browser delivery

    Connect the DOM binding before your app sends events.

  3. 03
    Clean up in order

    Dispose the DOM binding before you dispose the runtime.

Options and return values

runtimeGenerativeA11yRuntimeRequired

Supplies AnnouncementIntent objects while remaining under your app's control.

Default
n/a
optionsDOMAnnouncerOptionsOptional

Forwarded to the owned DOM announcer.

Default
{}
returnDOMRuntimeBindingReturn

Provides the announcer and an idempotent dispose function.

Default
n/a

DOMRuntimeBinding

dispose leaves app-supplied runtimes and live regions intact.

Options and return values

announcerDOMAnnouncerProperty

Owned announcer used for every runtime intent.

Default
n/a
dispose()voidMethod

Unsubscribes from the runtime and disposes the owned announcer.

Default
n/a