@uni-store/core
Version:
Unified Store
222 lines (155 loc) • 5.82 kB
TypeScript
import { computed } from '@vue/reactivity';
import { ComputedGetter } from '@vue/reactivity';
import { ComputedRef } from '@vue/reactivity';
import { ComputedSetter } from '@vue/reactivity';
import { customRef } from '@vue/reactivity';
import { CustomRefFactory } from '@vue/reactivity';
import { DebuggerEvent } from '@vue/reactivity';
import { DebuggerEventExtraInfo } from '@vue/reactivity';
import { DebuggerOptions } from '@vue/reactivity';
import { DeepReadonly } from '@vue/reactivity';
import { effect } from '@vue/reactivity';
import { EffectScheduler } from '@vue/reactivity';
import { EffectScope } from '@vue/reactivity';
import { effectScope } from '@vue/reactivity';
import { getCurrentScope } from '@vue/reactivity';
import { isProxy } from '@vue/reactivity';
import { isReactive } from '@vue/reactivity';
import { isReadonly } from '@vue/reactivity';
import { isRef } from '@vue/reactivity';
import { isShallow } from '@vue/reactivity';
import { markRaw } from '@vue/reactivity';
import { nextTick } from '@vue/runtime-core';
import { onScopeDispose } from '@vue/reactivity';
import { proxyRefs } from '@vue/reactivity';
import { reactive } from '@vue/reactivity';
import { ReactiveEffect } from '@vue/reactivity';
import { ReactiveEffectOptions } from '@vue/reactivity';
import { ReactiveEffectRunner } from '@vue/reactivity';
import { ReactiveFlags } from '@vue/reactivity';
import { readonly } from '@vue/reactivity';
import { Ref } from '@vue/reactivity';
import { ref } from '@vue/reactivity';
import { ShallowReactive } from '@vue/reactivity';
import { shallowReactive } from '@vue/reactivity';
import { shallowReadonly } from '@vue/reactivity';
import { ShallowRef } from '@vue/reactivity';
import { shallowRef } from '@vue/reactivity';
import { ShallowUnwrapRef } from '@vue/reactivity';
import { stop as stop_2 } from '@vue/reactivity';
import { toRaw } from '@vue/reactivity';
import { ToRef } from '@vue/reactivity';
import { toRef } from '@vue/reactivity';
import { ToRefs } from '@vue/reactivity';
import { toRefs } from '@vue/reactivity';
import { TrackOpTypes } from '@vue/reactivity';
import { TriggerOpTypes } from '@vue/reactivity';
import { triggerRef } from '@vue/reactivity';
import { unref } from '@vue/reactivity';
import { UnwrapNestedRefs } from '@vue/reactivity';
import { UnwrapRef } from '@vue/reactivity';
import { watch } from '@vue/runtime-core';
import { WatchCallback } from '@vue/runtime-core';
import { WatchEffect } from '@vue/runtime-core';
import { watchEffect } from '@vue/runtime-core';
import { WatchOptions } from '@vue/runtime-core';
import { WatchOptionsBase } from '@vue/runtime-core';
import { watchPostEffect } from '@vue/runtime-core';
import { WatchSource } from '@vue/runtime-core';
import { WatchStopHandle } from '@vue/runtime-core';
import { watchSyncEffect } from '@vue/runtime-core';
import { WritableComputedOptions } from '@vue/reactivity';
import { WritableComputedRef } from '@vue/reactivity';
export { computed }
export { ComputedGetter }
export { ComputedRef }
export { ComputedSetter }
export { customRef }
export { CustomRefFactory }
export { DebuggerEvent }
export { DebuggerEventExtraInfo }
export { DebuggerOptions }
export { DeepReadonly }
/**
* Create a `useStore` function that retrieves the store instance
*
* @param setup - function that creates the store
* @returns `useStore` function with `reset` param that determines whether create a new store instance
*/
export declare function defineStore<SS extends object, S = UnwrapNestedRefs<SS>>(setup: () => SS): (reset?: boolean) => Store<SS, S>;
export { effect }
export { EffectScheduler }
export { EffectScope }
export { effectScope }
export { getCurrentScope }
export { isProxy }
export { isReactive }
export { isReadonly }
export { isRef }
export { isShallow }
export { markRaw }
export { nextTick }
export { onScopeDispose }
export { proxyRefs }
export { reactive }
export { ReactiveEffect }
export { ReactiveEffectOptions }
export { ReactiveEffectRunner }
export { ReactiveFlags }
export { readonly }
export { Ref }
export { ref }
export { ShallowReactive }
export { shallowReactive }
export { shallowReadonly }
export { ShallowRef }
export { shallowRef }
export { ShallowUnwrapRef }
export { stop_2 as stop }
/**
* Store type. With state and functions.
*/
export declare type Store<SS extends object, S = UnwrapNestedRefs<SS>> = {
/**
* State of the Store
*/
readonly $state: S;
/**
* Stops the associated effect scope of the store.
*/
$dispose: () => void;
/**
* Setups a callback to be called whenever the state changes. It also returns
* a function to remove the callback.
*
* @param callback - callback passed to the watcher
* @param options - `watch` options
* @returns function that removes the watcher
*/
$subscribe: (callback: SubscriptionCallback<S>, options?: object) => () => void;
} & S;
declare type SubscriptionCallback<S> = (state: S) => void;
export { toRaw }
export { ToRef }
export { toRef }
export { ToRefs }
export { toRefs }
export { TrackOpTypes }
export { TriggerOpTypes }
export { triggerRef }
export { unref }
export { UnwrapNestedRefs }
export { UnwrapRef }
export { watch }
export { WatchCallback }
export { WatchEffect }
export { watchEffect }
export { WatchOptions }
export { WatchOptionsBase }
export { watchPostEffect }
export { WatchSource }
export { WatchStopHandle }
export { watchSyncEffect }
export { WritableComputedOptions }
export { WritableComputedRef }
export { }