import { buildRegFn } from './buildRegFn' ; /**
 * 通用UI api设置
 */ type ToastsType = 'info' | 'success' | 'error' | 'warning' ; export const [ showToasts , setToasts ] = buildRegFn < ( message : string , type ? : ToastsType ) => void > ( 'toasts' ) ; param error export function showErrorToasts ( error ) { let msg = '' ; if ( error instanceof Error ) { msg = error . message ; } else { msg = String ( error ) ; } showToasts ( msg , 'error' ) ; } interface AlertOptions { message : React . ReactNode ; onConfirm ? : ( ) => void | Promise < void > ; } export const [ showAlert , setAlert ] = buildRegFn < ( options : AlertOptions ) => void > ( 'alert' ) ; /**
 * 全局Loading提示
 * 返回移除函数
 */ export const [ showGlobalLoading , setGlobalLoading ] = buildRegFn < ( text : string ) => ( ) => void > ( 'global-loading' , ( ) => { return ( ) => { } ; } ) ;