Files
Netcatty/application/state/pluginViewSessionRegistry.ts
T

19 lines
595 B
TypeScript

type CloseablePluginViewSessions = {
closeView(viewId: string): void;
};
let loadedSessions: CloseablePluginViewSessions | null = null;
/**
* Registers the live PluginViewSessions singleton once the lazy host-drawn
* plugin view bundle loads, so startup lifecycle hooks can close views without
* statically importing css-tree / @remote-dom/core.
*/
export function registerLoadedPluginViewSessions(sessions: CloseablePluginViewSessions): void {
loadedSessions = sessions;
}
export function closePluginViewSessionIfLoaded(viewId: string): void {
loadedSessions?.closeView(viewId);
}