summaryrefslogtreecommitdiffhomepage
path: root/packages/desktop/src/PlatformContext.tsx
blob: 5b510a8d457d66611fb4f2a1c198bbf1d8f77eb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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
}