UNPKG

@virtualstate/examples

Version:
40 lines 1.06 kB
import { EnableThen } from "@virtualstate/fringe"; export class Element { static [EnableThen] = true; #reference = Symbol("Element"); #options; #parent; #children; #instance; #document; constructor(options, children) { this.#options = options; this.#children = children; } get reference() { return this.#reference; } get source() { return this.#options.tag; } get options() { return { ...this.#options.attributes }; } get element() { return this.#instance = this.#instance ?? this.document.createElement(this.source); } set document(document) { this.#document = document; } get document() { return this.#document ?? typeof document === "undefined" ? undefined : document; } async *[Symbol.asyncIterator]() { // await new Promise(thenish.bind(<>{this.#children}</>)); // Yield this once mounted all children yield this; } } //# sourceMappingURL=element.js.map