4 The author disclaims copyright to this source code. In place of a
5 legal notice, here is a blessing:
7 * May you do good and not evil.
8 * May you find forgiveness for yourself and forgive others.
9 * May you share freely, never taking more than you give.
11 ***********************************************************************
13 This file is the tail end of the sqlite3-api.js constellation,
14 intended to be appended after all other sqlite3-api-*.js files so
15 that it can finalize any setup and clean up any global symbols
16 temporarily used for setting up the API's various subsystems.
19 if('undefined' !== typeof Module){ // presumably an Emscripten build
21 Install a suitable default configuration for sqlite3ApiBootstrap().
23 const SABC = Object.assign(
24 Object.create(null), {
25 exports: ('undefined'===typeof wasmExports)
26 ? Module['asm']/* emscripten <=3.1.43 */
27 : wasmExports /* emscripten >=3.1.44 */,
28 memory: Module.wasmMemory /* gets set if built with -sIMPORTED_MEMORY */
30 globalThis.sqlite3ApiConfig || {}
34 For current (2022-08-22) purposes, automatically call
35 sqlite3ApiBootstrap(). That decision will be revisited at some
36 point, as we really want client code to be able to call this to
37 configure certain parts. Clients may modify
38 globalThis.sqlite3ApiBootstrap.defaultConfig to tweak the default
39 configuration used by a no-args call to sqlite3ApiBootstrap(),
40 but must have first loaded their WASM module in order to be
41 able to provide the necessary configuration state.
43 //console.warn("globalThis.sqlite3ApiConfig = ",globalThis.sqlite3ApiConfig);
44 globalThis.sqlite3ApiConfig = SABC;
47 sqlite3 = globalThis.sqlite3ApiBootstrap();
49 console.error("sqlite3ApiBootstrap() error:",e);
52 delete globalThis.sqlite3ApiBootstrap;
53 delete globalThis.sqlite3ApiConfig;
56 Module.sqlite3 = sqlite3 /* Needed for customized sqlite3InitModule() to be able to
57 pass the sqlite3 object off to the client. */;
59 console.warn("This is not running in an Emscripten module context, so",
60 "globalThis.sqlite3ApiBootstrap() is _not_ being called due to lack",
61 "of config info for the WASM environment.",
62 "It must be called manually.");