obsidian-lib-state
Provides access to the process-wide shared-state bag on the __obsidianLib global. New generic state belongs in @mnaoumov/typescript-lib/typescript-lib-state (the Symbol.for('@mnaoumov/typescript-lib/state') slot).
The bag is stored on globalThis.__obsidianLib, i.e. on the global object of the realm in which this library is loaded. Because a function’s globalThis resolves to its defining realm (not the caller’s), every consumer that bundles the library in the main Obsidian renderer shares the same bag, regardless of which window is currently active, so callers never need to pass an App instance.
Functions
Section titled “Functions”| Function | Description |
|---|---|
| getObsidianLibState | Retrieves or creates a shared-state ValueWrapper for a given key on globalThis.__obsidianLib. |
| resetObsidianLibState | Clears the shared-state bag on globalThis.__obsidianLib. Intended for test isolation: call it before each test so accumulated state (queues, registered handlers, etc.) does not leak between tests. |