@codelet/core
Version:
mini core
23 lines (22 loc) • 802 B
TypeScript
import type { Loose } from '@daysnap/types';
type ToastCallbackObject = Loose<{
setData: (data?: Record<string, any>) => void;
}>;
type ToastCallback = ((err: unknown, message: string) => boolean | void) | string | ToastCallbackObject;
declare global {
interface Promise<T> {
toast(cb?: ToastCallback, isThrow?: boolean): Promise<T>;
null(): Promise<T>;
fix(): Promise<T>;
}
}
export interface PromiseOptions {
/** 格式化错误消息 */
formatMessage?: (err: unknown) => string;
/** 排除指定错误消息 */
excludeMessage?: (message: string) => boolean;
/** 默认调用 showToast */
showToast?: (message: string) => void;
}
export declare const promise: (_: import("../codelet").Codelet, options?: PromiseOptions) => void;
export {};