UNPKG

@bigmi/core

Version:

TypeScript library for Bitcoin apps.

12 lines (11 loc) 567 B
import type { MaybePromise } from '../types/utils.js'; type Callback = ((...args: any[]) => any) | undefined; type Callbacks = Record<string, Callback>; export declare const listenersCache: Map<string, { id: number; fns: Callbacks; }[]>; export declare const cleanupCache: Map<string, () => void>; type EmitFunction<callbacks extends Callbacks> = (emit: callbacks) => MaybePromise<void | (() => void)>; export declare function observe<callbacks extends Callbacks>(observerId: string, callbacks: callbacks, fn: EmitFunction<callbacks>): () => void; export {};