mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-02 07:03:45 +00:00
15 lines
390 B
TypeScript
15 lines
390 B
TypeScript
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
|
|
}
|