2025-12-07 19:32:53 +02:00
|
|
|
import type { RuntimeAPIs } from '@/lib/api/types';
|
|
|
|
|
|
|
|
|
|
let registeredRuntimeAPIs: RuntimeAPIs | null = null;
|
|
|
|
|
|
|
|
|
|
export const registerRuntimeAPIs = (apis: RuntimeAPIs | null): void => {
|
|
|
|
|
registeredRuntimeAPIs = apis;
|
|
|
|
|
};
|
|
|
|
|
|
2026-06-02 00:43:05 +03:00
|
|
|
export const getRegisteredRuntimeAPIs = (): RuntimeAPIs | null => {
|
|
|
|
|
if (registeredRuntimeAPIs) {
|
|
|
|
|
return registeredRuntimeAPIs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (typeof window === 'undefined') {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (window as typeof window & { __OPENCHAMBER_RUNTIME_APIS__?: RuntimeAPIs })
|
|
|
|
|
.__OPENCHAMBER_RUNTIME_APIS__ ?? null;
|
|
|
|
|
};
|