import { Ref, WatchOptions, WritableComputedRef } from '@mpxjs/core'; import { Fn, MaybeComputedRef } from '@mpxjs/mpxuse-shared'; export * from '@mpxjs/mpxuse-shared'; declare function useCached(refValue: Ref, comparator?: (a: T, b: T) => boolean, watchOptions?: WatchOptions): Ref; declare type EventBusListener = (event: T, payload?: P) => void; declare type EventBusEvents = EventBusListener[]; declare type EventBusKey = symbol; declare type EventBusIdentifier = EventBusKey | string | number; interface UseEventBusReturn { /** * Subscribe to an event. When calling emit, the listeners will execute. * @param listener watch listener. * @returns a stop function to remove the current callback. */ on: (listener: EventBusListener) => Fn; /** * Similar to `on`, but only fires once * @param listener watch listener. * @returns a stop function to remove the current callback. */ once: (listener: EventBusListener) => Fn; /** * Emit an event, the corresponding event listeners will execute. * @param event data sent. */ emit: (event?: T, payload?: P) => void; /** * Remove the corresponding listener. * @param listener watch listener. */ off: (listener: EventBusListener) => void; /** * Clear all events */ reset: () => void; } declare function useEventBus(key: EventBusIdentifier): UseEventBusReturn; interface Serializer { read(raw: string): T; write(value: T): string; } declare const StorageSerializers: Record<'boolean' | 'object' | 'number' | 'any' | 'string' | 'map' | 'set' | 'date', Serializer>; interface OptionsKeys extends Object { sync?: boolean; encrypt?: boolean; serializer?: Serializer; shallow?: boolean; onError?: (error: unknown) => void; } declare function useStorage(key: string, value?: MaybeComputedRef, options?: OptionsKeys): Ref; /** * Reactive document title. * * @see https://mpxuse.cn/useTitle * @param newTitle * @param options */ declare function useTitle(newTitle?: MaybeComputedRef): WritableComputedRef; declare type UseTitleReturn = ReturnType; export { EventBusEvents, EventBusIdentifier, EventBusKey, EventBusListener, OptionsKeys, Serializer, StorageSerializers, UseEventBusReturn, UseTitleReturn, useCached, useEventBus, useStorage, useTitle };