Skip to content

obsidian-dev-utils-state

Provides access to a process-wide shared-state bag used internally by obsidian-dev-utils.

The bag is stored on globalThis.__obsidianDevUtils, i.e. on the global object of the realm in which obsidian-dev-utils 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. This intentionally replaces the previous App-scoped storage, so callers no longer need to pass an App instance.

FunctionDescription
getObsidianDevUtilsStateRetrieves or creates a shared-state ValueWrapper for a given key on globalThis.__obsidianDevUtils.
resetObsidianDevUtilsStateClears the shared-state bag on globalThis.__obsidianDevUtils. Intended for test isolation: call it before each test so accumulated state (debuggers, queues, registered handlers, etc.) does not leak between tests.