Ran pnpm oxfmt . This should get the web repo aligned so that we can better enforce oxfmt going forward.
18 lines
526 B
TypeScript
18 lines
526 B
TypeScript
import type { MeshRegistry } from "@meshtastic/sdk";
|
|
import { useContext } from "react";
|
|
import { MeshRegistryContext } from "../provider/MeshRegistryContext.ts";
|
|
|
|
export function useMeshRegistry(): MeshRegistry {
|
|
const registry = useContext(MeshRegistryContext);
|
|
if (!registry) {
|
|
throw new Error(
|
|
"useMeshRegistry must be called inside a <MeshRegistryProvider>.",
|
|
);
|
|
}
|
|
return registry;
|
|
}
|
|
|
|
export function useOptionalMeshRegistry(): MeshRegistry | undefined {
|
|
return useContext(MeshRegistryContext);
|
|
}
|