import { DependencyList } from 'react'; import { BehaviorSubject, Observable } from 'rxjs'; import { EqualityFunction } from '@spicy-hooks/core'; import { Snapshot } from './use-snapshot'; /** * Simple unary function that is meant to select sub-part of a state. * * @typeParam S original shape * @typeParam P extracted partial shape */ export declare type SelectorFunction = (state: S) => P; /** * A simple helper that takes a snapshot of a part of the `observable` defined by the `selector`. * The snapshot is recomputed when the `deps` change so that an updated selector can be applied. * * *Note:* An `Object.is` equality check is applied to the selected sub-part in order to avoid unnecessary re-renders. * In other words the snapshot will be updated only in case the new emission's identity differs from the previous one's. * * @param observable source observable to subscribe to * @param selector function used to select sub-part of the observable state * @param deps dependencies for the selector function * @type T type of the source emissions * @type P type of the partial state * @category Hook */ export declare function usePartialSnapshot(observable: BehaviorSubject, selector: SelectorFunction, deps: DependencyList): Snapshot

; export declare function usePartialSnapshot(observable: Observable, selector: SelectorFunction, deps: DependencyList): Snapshot

; export declare function usePartialSnapshot(observable: BehaviorSubject | undefined | null, selector: SelectorFunction, deps: DependencyList): Snapshot

; export declare function usePartialSnapshot(observable: Observable | undefined | null, selector: SelectorFunction, deps: DependencyList): Snapshot

; /** * A simple hel per that takes a snapshot of a part of the `observable` defined by the `selector`. * The snapshot is recomputed when the `deps` change so that an updated selector can be applied. * * The `equalityFunc` is applied to the selected sub-part in order to avoid unnecessary re-renders. * In other words the snapshot will be updated only in case the new emission differs from the previous one in the sense of `equalityFunc`. * * @param observable source observable to subscribe to * @param selector function used to select sub-part of the observable state * @param equalityFunc equality function to check whether the selected sub-part actually changed from the previous one * @param deps dependencies for the selector function * @type T type of the source emissions * @type P type of the partial state * @category Hook */ export declare function usePartialSnapshot(observable: BehaviorSubject, selector: SelectorFunction, equalityFunc: EqualityFunction

, deps: DependencyList): Snapshot

; export declare function usePartialSnapshot(observable: Observable, selector: SelectorFunction, equalityFunc: EqualityFunction

, deps: DependencyList): Snapshot

; export declare function usePartialSnapshot(observable: BehaviorSubject | undefined | null, selector: SelectorFunction, equalityFunc: EqualityFunction

, deps: DependencyList): Snapshot

; export declare function usePartialSnapshot(observable: Observable | undefined | null, selector: SelectorFunction, equalityFunc: EqualityFunction

, deps: DependencyList): Snapshot

; //# sourceMappingURL=use-partial-snapshot.d.ts.map