@virtualstate/examples
Version:
43 lines • 1.61 kB
JavaScript
import { h, createFragment } from "@virtualstate/fringe";
async function Parent(options, input) {
const children = (await input?.children) ?? [];
return (h("parent", { empty: !children.length }, children.length ? children : "\n"));
}
const EmptyChild1 = undefined;
const EmptyChild2 = () => undefined;
const EmptyChild3 = () => h(() => undefined);
const EmptyChild4 = () => h(async () => undefined);
const EmptyChild5 = () => h(async function* () { });
const EmptyChild6 = () => h(async function* () {
yield "Initial loading"; // Initial yields a loading indicator
await new Promise(resolve => setTimeout(resolve, 10));
// Settles that there is nothing to render
yield h(EmptyChild5, null);
});
const EmptyChild7 = () => h(async function* () {
yield "Initial loading"; // Initial yields a loading indicator
await new Promise(resolve => setTimeout(resolve, 10));
// Settles that there is nothing to render
yield undefined;
});
const ActualChild1 = () => h(async () => "actual value!");
export const _CH0001 = (h(createFragment, null,
h(Parent, null,
h(EmptyChild1, null)),
h(Parent, null,
h(EmptyChild2, null)),
h(Parent, null,
h(EmptyChild3, null)),
h(Parent, null,
h(EmptyChild4, null)),
h(Parent, null,
h(EmptyChild5, null)),
h(Parent, null,
h(EmptyChild6, null)),
h(Parent, null,
h(EmptyChild7, null)),
h(Parent, null,
h(ActualChild1, null))));
export const _CH0001_URL = import.meta.url;
export const _CH0001_IsResolving = true;
//# sourceMappingURL=empty-children.js.map