start
Starts REALM in the current document. realm.js calls it for you.
start(): void<script type="module">
import { start } from "https://cdn.jsdelivr.net/npm/@realmorg/realm@alpha/dist/index.js";
start();
</script>What it does
- Adopts a page stylesheet:
custom-element, import-element { display: none !important }andis-visible, is-hidden, repeat-list { display: contents }. - Registers
<import-element>, unless something already defined that name. - Defines every
<custom-element>in the document and removes it from the page. - Watches the document with a
MutationObserver:<custom-element>elements added later are defined too, and custom tags are noticed for lazy imports.
Inline definitions are resolved against document.baseURI.
Notes
- Safe to call more than once. Later calls do nothing.
- Takes no arguments and returns nothing. Definitions are created asynchronously, and elements upgrade as their definitions arrive.