/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import type { DnssdName } from "./DnssdName.js"; import type { DnssdNames } from "./DnssdNames.js"; /** * Async iterable that yields discovered {@link DnssdName}s. * * Since `DnssdName` extends `BasicObservable` (making it `AsyncIterable`), using * `AsyncIterableIterator` directly causes TypeScript to infer the wrong yield type. This dedicated * interface avoids that issue. */ export interface NameDiscovery { next(): Promise>; return(): Promise>; [Symbol.asyncIterator](): NameDiscovery; } /** * Discover DNS-SD service instances matching a suffix. * * Returns an async iterable that yields each newly discovered {@link DnssdName} whose qname ends with the given * suffix. The caller controls lifetime via {@link AbortSignal}: abort to stop discovery. Cleanup (filter * removal, observer detach) happens automatically — whether stopped by abort or by `break`/`return` in a * `for await` loop. * * Example: * ```typescript * const controller = new AbortController(); * setTimeout(() => controller.abort(), 5000); * * for await (const name of discoverNames(names, "_myservice._tcp.local", controller.signal)) { * console.log("found", name.qname); * } * ``` */ export declare function discoverNames(names: DnssdNames, suffix: string, signal: AbortSignal): NameDiscovery; //# sourceMappingURL=ServiceDiscovery.d.ts.map