@esmx/core
Version:
A high-performance microfrontend framework supporting Vue, React, Preact, Solid, and Svelte with SSR and Module Federation capabilities.
17 lines (16 loc) • 350 B
JavaScript
export function createCache(enable) {
if (enable) {
const map = /* @__PURE__ */ new Map();
return async (name, fetch) => {
if (map.has(name)) {
return map.get(name);
}
const result = await fetch();
map.set(name, result);
return result;
};
}
return (name, fetch) => {
return fetch();
};
}