blob: d8a556e0119e65213b37fc7ac673c0be9f0ed4ca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import type { ContentRegistry } from '@hollowdark/content-system/registry/registry'
let instance: ContentRegistry | null = null
/** Record the registry populated during session startup. */
export function setContentRegistry(registry: ContentRegistry): void {
instance = registry
}
/**
* Access the shared content registry. Throws if called before the
* loading pipeline has populated it — simulation code should never run
* until initial load is complete.
*/
export function getContentRegistry(): ContentRegistry {
if (instance === null) {
throw new Error('Content registry not initialised. Initial load must complete first.')
}
return instance
}
/** True once the registry has been populated. */
export function hasContentRegistry(): boolean {
return instance !== null
}
|