UNPKG

@scalar/api-client

Version:

the open source API testing client

25 lines (24 loc) 584 B
const s = ({ plugins: o = [] }) => { const a = /* @__PURE__ */ new Map(); return o.forEach((r) => { const e = r(); a.set(e.name, e); }), { /** * Get all components for a specific view */ getViewComponents: (r) => Array.from(a.values()).flatMap((e) => e.views[r] || []), /** * Execute a hook for a specific event */ executeHook: (r, ...e) => { const t = Array.from(a.values()).flatMap((n) => n.hooks[r] || []); return Promise.all( t.map((n) => n(...e)) ); } }; }; export { s as createPluginManager };