DOM adapter
Enhance existing HTML with react-7tv/dom. No React runtime required.
Usage
import { enhance7tvContent } from "react-7tv/dom";
const controller = enhance7tvContent(root, {
emotes,
excludeSelector: "astro-island, [data-owned]",
});
controller.refresh(); // Scan existing content again.
controller.disconnect(); // Restore text and stop observing.Options
| Option | Default |
|---|---|
emotes | Required |
syntax | Plain, case-sensitive |
observe | true |
animated | true |
size | 2 |
excludeElements | Code, controls, scripts, and other safe defaults |
excludeSelector | None |
Lifecycle
- New and changed text nodes are matched automatically.
- Editable content, code blocks, and foreign namespaces are skipped.
- disconnect() restores replacements, including inside detached roots.
- Disconnect and recreate the adapter when options or emotes change.
- Use this only outside framework-managed DOM.