// 加载第三方库 export const loadLib = (() => { const cache: Record> = {}; const load = ( lib: string, success: () => void, err: () => void, maxReq = 0 ) => { const el = document.createElement("script"); el.src = lib; document.body.appendChild(el); el.onload = success; el.onerror = () => { if (maxReq > 0) { load(lib, success, err, --maxReq); } else { err(); } }; }; return (lib: string) => { if (!cache[lib]) { cache[lib] = new Promise((resolve, reject) => { load(lib, resolve, reject, 3); }); } return cache[lib]; }; })(); export const togetherCallback = (cbs: (() => void)[]) => () => together(cbs) export const together = (cbs: (() => void)[]) => { cbs.forEach(cb => cb()) } export * from './store-help' export * from "./stack"; export * from "./loading"; export * from "./route"; export * from "./asyncBus"; export * from './mount' export * from './watch' export * from './diff'