import type { Maybe, Path } from "@thi.ng/api"; import type { IComponent, IMountWithState, NumOrElement } from "./api.js"; /** * Takes an ES `AsyncIterable` and creates a simple component wrapper for its * asynchronously produced values. * * @remarks * If given an {@link IMountWithState} component, new values are applied via the * `.update()` life cycle value. If given a `tag` and `attribs`, a corresponding * element wrapper component will be created automatically (using * {@link $wrapText} and incoming values will be applied using {@link $text} * (aka setting `el.innerText`). * * @example * ```ts * import { $async } from "@thi.ng/rdom"; * import { range } from "@thi.ng/transducers-async"; * * // infinite 1Hz counter * const counter = range(1000); * * // wrapper component which updates whenever counter produces new values * $async(counter, "div", { class: "red" }).mount(document.body); * ``` * * @param src - * @param inner - */ export declare function $async(src: AsyncIterable, inner: IMountWithState): IComponent; export declare function $async(src: AsyncIterable, tag: string, attribs?: any): IComponent; export declare class $Async { protected src: AsyncIterable; protected inner: IMountWithState>; el?: Element; constructor(src: AsyncIterable, inner: IMountWithState>); mount(parent: ParentNode, index?: NumOrElement): Promise; unmount(): Promise; update(x: T): void; } export declare const $asyncA: (src: AsyncIterable, comp: IComponent, path: Path) => Promise; //# sourceMappingURL=async.d.ts.map