UNPKG

@virtualstate/examples

Version:
34 lines 986 B
import { h } from "../../jsx.js"; import { And } from "../experiments/combinational/and.js"; import { Collector } from "microtask-collector"; class Component { options; iterations = 0; collector = new Collector({ eagerCollection: true }); seen = []; constructor(options) { this.options = options; void this.watch(); } async watch() { for await (const batch of this.collector) { this.seen.push(...batch); } } async *[Symbol.asyncIterator]() { const id = this.iterations += 1; this.collector.add(id); yield { reference: `Iteration ${id} 🦆` }; yield `Seen: ${this.seen.join(", ")} 🐸`; } } const node = h(Component, { expect: 3 }); export const _407_SharedCollector = (h("container", null, h(And, { size: 3, self: true }, node, node, node))); export const _407_URL = import.meta.url; //# sourceMappingURL=shared-collector.js.map