import { Ref } from 'vue' import { LoguxVuexStore } from '../index.js' export type Channel = | string | { channel: string [key: string]: any } export type Channels = Channel[] | Ref export interface useSubscriptionOptions { /** * Logux Vuex store. */ store?: LoguxVuexStore /** * Delay in milliseconds to avoid returning `true` when switching between `channels`. */ debounce?: number } /** * Composable function that subscribes * for channels during component initialization * and unsubscribes on unmount. * * It watches for `channels` changes * and returns `isSubscribing` flag that indicates loading state. * * ```html * * * * * ``` * @param channels Channels to subscribe. * @param options Options. * @return `true` during data loading. */ export function useSubscription( channels: Channels, options?: useSubscriptionOptions ): Ref