diff options
| author | Brendan Allan <[email protected]> | 2025-12-08 13:43:36 +0800 |
|---|---|---|
| committer | Brendan Allan <[email protected]> | 2025-12-08 13:43:36 +0800 |
| commit | d531dff8d3f5c60df2e5c08e8bd04bf9a234dbc3 (patch) | |
| tree | 7c38fd75c3e6f04307b78abe7a93c8321e041143 /packages/desktop/src/PlatformContext.tsx | |
| parent | 923bf36593e517196a332ddce2ffe5f2fd216f5e (diff) | |
| download | opencode-d531dff8d3f5c60df2e5c08e8bd04bf9a234dbc3.tar.gz opencode-d531dff8d3f5c60df2e5c08e8bd04bf9a234dbc3.zip | |
Export DesktopInterface from desktop and add PlatformContext
Diffstat (limited to 'packages/desktop/src/PlatformContext.tsx')
| -rw-r--r-- | packages/desktop/src/PlatformContext.tsx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/desktop/src/PlatformContext.tsx b/packages/desktop/src/PlatformContext.tsx new file mode 100644 index 000000000..5b510a8d4 --- /dev/null +++ b/packages/desktop/src/PlatformContext.tsx @@ -0,0 +1,14 @@ +import { createContext } from "solid-js" +import { useContext } from "solid-js" + +export interface Platform {} + +const PlatformContext = createContext<Platform>() + +export const PlatformProvider = PlatformContext.Provider + +export function usePlatform() { + const ctx = useContext(PlatformContext) + if (!ctx) throw new Error("usePlatform must be used within a PlatformProvider") + return ctx +} |
