expose Ignis API, implement shared ws client

This commit is contained in:
Nystik
2026-05-24 21:51:02 +02:00
parent 9eeff3c1b3
commit 28effab1ed
29 changed files with 824 additions and 745 deletions

View File

@@ -0,0 +1,28 @@
// Public Ignis API surface. The documented way for plugins (and Ignis-internal code) to reach shim services.
// WIP, may expand to cover more shared functionality.
export function installIgnisApi(wsClient) {
window.__ignis = window.__ignis || {};
// Live getters so vault info reflects whatever init.js / vault-switch code has set.
Object.defineProperty(window.__ignis, "vault", {
get() {
return {
id: window.__currentVaultId || null,
path: window.__vaultConfig?.path || null,
};
},
enumerable: true,
configurable: true,
});
window.__ignis.ws = {
subscribe: wsClient.subscribe,
send: wsClient.send,
channel: wsClient.channel,
isOpen: wsClient.isOpen,
onStateChange: wsClient.onStateChange,
};
window.__ignis.plugins = window.__ignis.plugins || {};
}