mirror of
https://github.com/immich-app/immich.git
synced 2026-03-30 05:12:16 -04:00
12 lines
395 B
TypeScript
12 lines
395 B
TypeScript
import type { AssetControlContext } from '$lib/types';
|
|
import { getContext, setContext } from 'svelte';
|
|
|
|
export function createContext<T>(key: string | symbol = Symbol()) {
|
|
return {
|
|
get: () => getContext<T>(key),
|
|
set: (context: T) => setContext<T>(key, context),
|
|
};
|
|
}
|
|
|
|
export const { get: getAssetControlContext, set: setAssetControlContext } = createContext<AssetControlContext>();
|