context.ts 218 B

12345678
  1. import { getContext, setContext } from 'svelte';
  2. export function createContext<T>(key: string | symbol = Symbol()) {
  3. return {
  4. get: () => getContext<T>(key),
  5. set: (context: T) => setContext<T>(key, context)
  6. };
  7. }