Spaces:
Runtime error
Runtime error
Download apps/webapp/app/utils/singleton.ts from BTankut/Context-Store-LLM: direct link, hf CLI and curl.
- Browser
- Download file 230 Bytes
-
https://huggingface.co/spaces/BTankut/Context-Store-LLM/resolve/main/apps/webapp/app/utils/singleton.ts
- Command line
-
hf download hf://spaces/BTankut/Context-Store-LLM/apps/webapp/app/utils/singleton.ts
-
curl -L -o singleton.ts https://huggingface.co/spaces/BTankut/Context-Store-LLM/resolve/main/apps/webapp/app/utils/singleton.ts
230 Bytes
| export function singleton<T>(name: string, getValue: () => T): T { | |
| const thusly = globalThis as any; | |
| thusly.__core_singletons ??= {}; | |
| thusly.__core_singletons[name] ??= getValue(); | |
| return thusly.__core_singletons[name]; | |
| } | |