Initial public release

This commit is contained in:
Bohdan Triapitsyn
2025-12-07 19:32:53 +02:00
commit 4b2edf7318
319 changed files with 81600 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
import React from 'react';
import type { RuntimeAPISelector, RuntimeAPIs } from '@/lib/api/types';
import { RuntimeAPIContext } from '@/contexts/runtimeAPIContext';
export const useRuntimeAPIs = (): RuntimeAPIs => {
const apis = React.useContext(RuntimeAPIContext);
if (!apis) {
throw new Error('Runtime APIs are not available. Did you forget to wrap the app in <RuntimeAPIProvider>?');
}
return apis;
};
export const useRuntimeAPI = <TValue,>(selector: RuntimeAPISelector<TValue>): TValue => {
const apis = useRuntimeAPIs();
return selector(apis);
};
export const useIsDesktopRuntime = (): boolean => useRuntimeAPI((api) => api.runtime.isDesktop);