import { Subscription } from 'rxjs'; import { EffectObserver, EventHandler } from '@rxfx/bus'; export interface HandlerArgs { matches: { match: ((i: TBusItem) => i is TMatchType) | ((i: TBusItem) => boolean); }; } export type TBusItem = any; export interface ListenerArgs extends HandlerArgs { handler: EventHandler; observeWith?: EffectObserver; } export interface FilterArgs extends HandlerArgs { filter: (item: TMatchType) => TBusItem | null | undefined; } /** * Registers a listener, but un-registers and re-registers it on any change of deps. * Existing handlings will be terminated. This may run more often that you expect, * given the nature of deps and unstable fucntions. * @see https://reactjs.org/docs/hooks-faq.html#what-can-i-do-if-my-effect-dependencies-change-too-often */ export declare function useClosureListener(args: ListenerArgs, deps?: any[]): Subscription; /** * Registers a filters, but un-registers and re-registers it on any change of deps. * This may run more often that you expect, given the nature of deps and unstable fucntions. * @see https://reactjs.org/docs/hooks-faq.html#what-can-i-do-if-my-effect-dependencies-change-too-often */ export declare function useClosureFilter(args: FilterArgs, deps?: any[]): Subscription;