UNPKG

@channel-state/vue

Version:

Vue composables for channel-state, providing seamless integration with Vue applications for cross-context state management.

24 lines (21 loc) 1.3 kB
import * as _channel_state_core from '@channel-state/core'; import { ChannelStore } from '@channel-state/core'; import * as vue from 'vue'; /** * A Vue Composition API hook that provides a reactive reference to a ChannelStore's state. * The returned `Ref` can be used directly in Vue templates and will automatically update * when the store's state changes (either locally or from other tabs/windows). * @template T The type of the state managed by the ChannelStore. * @param store The ChannelStore instance to connect to. * @returns A `Ref` object that represents the current state of the ChannelStore. * Assigning a new value to this `Ref` will update the ChannelStore's state. */ declare function useChannelState<T>(store: ChannelStore<T>): vue.WritableComputedRef<T, T>; /** * A Vue Composition API hook that provides a reactive reference to a ChannelStore's status. * The returned `Ref` reflects the current lifecycle status of the ChannelStore. * @param store The ChannelStore instance to connect to. * @returns A `Ref` object that represents the current status of the ChannelStore. */ declare function useChannelStatus(store: ChannelStore<unknown>): vue.Ref<_channel_state_core.StoreStatus, _channel_state_core.StoreStatus>; export { useChannelState, useChannelStatus };