@daysnap/horn-use
Version:
horn use
15 lines (14 loc) • 725 B
TypeScript
export interface UseVisibleOptions<T extends Record<string, any>, P = any> {
showCallback?: (options?: T) => void | Promise<void>;
hideCallback?: (reason: any) => void | Promise<void>;
confirmCallback?: (...args: any[]) => P | Promise<P>;
}
export interface UseVisibleShowOptions {
beforeClose?: (action: 'cancel' | 'confirm', ...args: any[]) => boolean | Promise<boolean>;
}
export declare const useVisible: <T extends Record<string, any>, R = any>(options?: UseVisibleOptions<T, R>) => {
visible: import("vue").Ref<boolean>;
show: <P = R>(options?: (UseVisibleShowOptions & T) | undefined) => Promise<P>;
confirm: (...args: any[]) => Promise<void>;
hide: (reason?: any) => Promise<void>;
};