MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / loadFeatures

Function loadFeatures

packages/ui-default/lazyload.ts:50–62  ·  view source on GitHub ↗
(name: string, ...args: any[])

Source from the content-addressed store, hash-verified

48
49export const loaded = [];
50export async function loadFeatures(name: string, ...args: any[]) {
51 if (loaded.includes(name)) return;
52 loaded.push(name);
53 for (const item of await getFeatures(name)) {
54 let apply = typeof item === 'function'
55 ? item
56 : (item.startsWith('http') || item.startsWith('/'))
57 ? await legacyLoadExternalModule(item)
58 : (await load(item)).apply;
59 if (typeof apply !== 'function') apply = apply.default || apply.apply;
60 if (typeof apply === 'function') await apply(...args);
61 }
62}
63
64export function provideFeature(name: string, content: string | (() => Promise<any>)) {
65 console.debug('Providing feature', name);

Callers

nothing calls this directly

Calls 5

getFeaturesFunction · 0.85
legacyLoadExternalModuleFunction · 0.70
loadFunction · 0.70
applyFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected