26 lines
1.3 KiB
TypeScript
26 lines
1.3 KiB
TypeScript
import { Ref } from "vue";
|
|
import { AsyncComputeRef, ComputeFn, ComputeRef, ScopeContext } from "../d";
|
|
declare function doComputed(getTargetFunc: any, getContextFn: () => any, excludes?: any[], userComputedFn?: (target: any) => any): import("vue").ComputedRef<any>;
|
|
export declare class ComputeValue<T = any, R = any> implements ComputeRef<T, R> {
|
|
computeFn: ComputeFn<T, R>;
|
|
constructor(computeFn: ComputeFn<T, R>);
|
|
}
|
|
export declare function compute<T = any, R = any>(computeFn: ComputeFn<T, R>): ComputeRef<T, R>;
|
|
export type GetContextFn = () => any;
|
|
export declare class AsyncComputeValue<RV, R = any, WV = any> implements AsyncComputeRef<RV, R> {
|
|
watch?: (context: ScopeContext<R>) => WV;
|
|
asyncFn: (value: WV, getContextFn: GetContextFn) => Promise<RV>;
|
|
defaultValue?: any;
|
|
constructor(options: AsyncComputeRef<RV, R>);
|
|
buildAsyncRef(getContextFn: GetContextFn): Ref<RV, RV>;
|
|
}
|
|
export declare function asyncCompute<RV = any, R = any, WV = any>(options: AsyncComputeRef<RV, R, WV>): AsyncComputeRef<RV, R, WV>;
|
|
export declare function useCompute(): {
|
|
ComputeValue: typeof ComputeValue;
|
|
compute: typeof compute;
|
|
AsyncComputeValue: typeof AsyncComputeValue;
|
|
asyncCompute: typeof asyncCompute;
|
|
doComputed: typeof doComputed;
|
|
};
|
|
export {};
|