@chatui/core
Version:
The React library for Chatbot UI
20 lines (19 loc) • 699 B
TypeScript
interface ImportScriptOptions {
/** 超时时间(毫秒),0 表示不限制,默认 5000 */
timeout?: number;
/** 重试次数,默认 3 */
retry?: number;
/** 初始重试延迟(毫秒),使用指数退避策略(1s → 2s → 4s → 8s),默认 1000 */
retryDelay?: number;
/** 是否启用缓存,基于 url::name 键,默认 false */
cache?: boolean;
}
/**
* 动态导入外部脚本
* @param url 脚本地址
* @param name 全局变量名
* @param options 配置项
* @returns Promise<T> 返回全局变量的值
*/
export declare function importScript<T>(url: string, name: string, options?: ImportScriptOptions): Promise<T>;
export {};