import type { IClosable, IWriteable } from "./api.js"; import { Channel } from "./channel.js"; /** * Syntax sugar for {@link Mult} ctor. Creates a new `Mult` which allows * multiple child subscriptions, each receiving the same values written to (or * received by) the Mult itself, i.e. it acts as a channel splitter, supporting * dynamic subscriptions and unsubscriptions. * * @remarks * If `src` is a channel, it will be used as input. If given a string, a new * channel with the given ID will be created (for receiving values). * * @param arg */ export declare const mult: (arg?: string | Channel) => Mult; export declare class Mult implements IWriteable, IClosable { protected src: Channel; protected taps: Channel[]; /** * See {@link mult} for reference. * * @param arg */ constructor(arg?: string | Channel); writable(): boolean; write(val: T): Promise; close(): void; closed(): boolean; /** * Attaches (and possibly creates) a new subscription channel to receive any * values received by the `Mult` itself. Returns it. * * @remarks * The channel can later be detached again via {@link Mult.unsubscribe}. * * @param ch */ subscribe(ch?: Channel): Channel; /** * Attempts to remove given subscription channel. Returns true if * successful. If `close` is true (default), the given channel will also be * closed (only if unsubscription was successful). * * @remarks * See {@link Mult.subscribe} for reverse op. * * @param ch * @param close */ unsubscribe(ch: Channel, close?: boolean): boolean; /** * Removes all child subscription channels and if `close` is true (default) * also closes them. * * @remarks * The `Mult` itself will remain active and will continue to accept new * subscriptions. * * @param close */ unsubscribeAll(close?: boolean): void; protected process(): Promise; } //# sourceMappingURL=mult.d.ts.map