UNPKG

webcontainer-sandbox-react

Version:

A React component library for WebContainer-based code sandboxes

23 lines (22 loc) 611 B
interface UseAsyncQueueOptions { /** * 是否在新任务到来时自动取消等待中的任务 * @default true */ cancelPending?: boolean; /** * 是否在执行新任务前先执行清理操作 * @default true */ cleanupBeforeNew?: boolean; /** * 调试模式,会输出日志 * @default false */ debug?: boolean; } export declare function useAsyncQueue(options?: UseAsyncQueueOptions): { enqueue: <T = any>(taskExecutor: () => Promise<T>, cleanupExecutor?: () => Promise<void>) => Promise<T>; cancelAll: () => void; }; export {};