API reference › @evolu/sqlite-wasm › initializeSqliteWasm

function initializeSqliteWasm(
  deps: SqliteWasmDep,
): () => Result<void, SqliteWasmInitializeError>;

Defined in: packages/sqlite-wasm/src/Wasm.ts:542

Initializes the library as loading steps 6 and 7 do, for use after sqlite3_shutdown and sqlite3_config.

sqlite3_initialize alone, or any call that initializes the library itself, such as an open, makes SQLite's unix-none VFS the default again and registers kvvfs again, so opening :localStorage: or :sessionStorage: traps and breaks the instance. Initializing leaves SQLite's random number generator as it is, but while unix-none is the default, a generator reset with sqlite3_randomness(0, 0), or not used since loading, seeds itself at its next use from the time and a constant pid instead of RandomBytes, so instances seeded in the same second share randomblob() values and journal nonces. This function resets the generator once evolu-memory is the default.

Fails with SqliteWasmInitializeError, with SQLITE_MISUSE when sqlite3_vfs_unregister removed evolu-memory.