import { OpenPromise } from "./OpenPromise.js"; /** * A subscription is a promise that gets reresolved multiple times. * * Subscriptions implments the asynchronous iterable protocol (@see AsyncIterable). * This makes it easy to iterate on subscriptions. * * @example ``` * async function demo() { * let subscription = new Subscription(); * * global.setTimeout(() => { * subscription.setCurrent(new Date().toString()); * }, 1000) * * for await (let item of subscription) { * console.log(item, "Subscription has new data") * } * } * ``` */ export declare class Subscription implements AsyncIterable { _current: T | undefined; pending: OpenPromise; [Symbol.asyncIterator](): AsyncIterator; get current(): Promise; setCurrent(value: T): void; } export declare class SubscribedResourceIterator implements AsyncIterator { source: Subscription; hasDeliveredFirst: boolean; constructor(source: Subscription); next(): Promise>; }