rc-js-util
Version:
A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.
20 lines • 956 B
TypeScript
import { TListener } from "./t-listener.js";
import { IBroadcastChannel } from "./i-broadcast-channel.js";
import type { ICleanupRegistry } from "../lifecycle/cleanup-registry.js";
/**
* @public
* Strong reference implementation of {@link IBroadcastChannel}.
*/
export declare class BroadcastChannel<TKey extends string, TArgs extends unknown[]> implements IBroadcastChannel<TKey, TArgs> {
private key;
constructor(key: TKey);
addListener(listener: TListener<TKey, TArgs>): void;
addListener(store: ICleanupRegistry, listener: TListener<TKey, TArgs>): void;
addOneTimeListener(listener: TListener<TKey, TArgs>): void;
addOneTimeListener(store: ICleanupRegistry, listener: TListener<TKey, TArgs>): void;
removeListener(listener: TListener<TKey, TArgs>): void;
emit(...args: TArgs): void;
getTargets(): readonly TListener<TKey, TArgs>[];
private readonly listeners;
}
//# sourceMappingURL=broadcast-channel.d.ts.map