UNPKG

@yamada-ui/react

Version:

React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion

40 lines (39 loc) 1.34 kB
import { LoadingMethod } from "../../core/system/index.types.js"; import { LoadingOptions } from "../../components/loading/loading-provider.js"; import { DependencyList } from "react"; //#region src/hooks/use-async-callback/index.d.ts type Callback = (...args: any[]) => any; interface UseAsyncCallbackOptions { /** * The method to use for loading. * If `false`, the loading will not be shown. */ loading?: false | LoadingMethod; /** * The options to pass to the loading component. */ loadingOptions?: LoadingOptions; /** * If `false`, the processing will not change. * * @default true */ processing?: boolean; } /** * `useAsyncCallback` is a custom hook used to manage async callbacks. * * @see https://yamada-ui.com/docs/hooks/use-async-callback */ declare const useAsyncCallback: <Y extends Callback>(callback: Y, deps: DependencyList, { loading: method, loadingOptions, processing: shouldProcessing }?: UseAsyncCallbackOptions) => UseAsyncCallbackReturn<Y>; type UseAsyncCallbackReturn<Y extends Callback> = [loading: boolean, callback: (...args: Parameters<Y>) => Promise<Awaited<ReturnType<Y>>>, control: { finish: () => void; start: () => void; }]; //#endregion export { UseAsyncCallbackOptions, UseAsyncCallbackReturn, useAsyncCallback }; //# sourceMappingURL=index.d.ts.map