Files
Brandyn / Techy fcc1b09210 init
2026-04-04 15:40:51 -05:00

52 lines
1.0 KiB
TypeScript

// Copyright Epic Games, Inc. All Rights Reserved.
import { RouteObject } from "react-router-dom";
// Routes => components
// backend queries
// mounting points???
export enum MountType {
TopNav
}
export type Mount = {
type: MountType,
context?: string;
text: string;
route: string;
}
export type HordePlugin = {
id: string;
routes: RouteObject[];
// single plugin mount point
mount?: Mount;
// multiple plugin mount points
mounts?: Mount[];
enabled?: boolean;
}
const plugins: HordePlugin[] = [];
export function registerHordePlugin(plugin: HordePlugin) {
const existing = plugins.find(p => p.id === plugin.id);
if (existing) {
throw `Duplicate plugin registration for id: ${plugin.id}`;
}
plugins.push(plugin);
}
export function enableHordePlugins(ids: string[]) {
const set = new Set(ids);
plugins.forEach(p => {
p.enabled = set.has(p.id)
});
}
export function getHordePlugins(): HordePlugin[] {
return plugins.filter(p => !!p.enabled);
}