15 lines
275 B
TypeScript
15 lines
275 B
TypeScript
import { getContext, hasContext, setContext } from "svelte";
|
|
import type { Me } from "./me";
|
|
|
|
export function setMeContext(me: Me) {
|
|
setContext("me", me);
|
|
}
|
|
|
|
export function getMeContext(): Me | null {
|
|
if (hasContext("me")) {
|
|
return getContext("me");
|
|
}
|
|
|
|
return null;
|
|
}
|