mirror of
https://github.com/Nystik-gh/ignis.git
synced 2026-06-17 04:35:53 +00:00
29 lines
833 B
JavaScript
29 lines
833 B
JavaScript
// 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 || {};
|
|
}
|