Something went wrong. Try again.
small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
Something went wrong. Try again.
123456789101112131415161718192021import type { Component } from 'svelte';
/** * A component that loads the first time it is asked for: every call returns * the same promise, so an `{#await}` on it never starts again. A failed load * (a chunk the server no longer has) is forgotten, so the next ask retries. */export function lazy<T extends Component<any>>( load: () => Promise<{ default: T }>,): () => Promise<T> { let loaded: Promise<T> | undefined; return () => (loaded ??= load().then( (module) => module.default, (failure) => { loaded = undefined; throw failure; }, ));}