API reference › @evolu/common › local‑first/Db › WaitForDatabaseRelease
type WaitForDatabaseRelease = (name: Name) => Task<void, DatabaseHeldError>;
Defined in: packages/common/src/local-first/Db.ts:246
Waits until no other context holds the files of the persistent database
name, and fails with DatabaseHeldError when they stay held.
startDbWorker calls it, except for a memory-only database, while it holds the database's leader lock and before it opens the database. Only a context that ended without closing the database can then hold its files, and such a context can only release them, so the files stay free until the database opens. Platforms whose databases cannot be held this way, such as Node.js and React Native, omit it.