1/* 2 2022-07-22 3 4 The author disclaims copyright to this source code. In place of a 5 legal notice, here is a blessing: 6 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. 10 11 *********************************************************************** 12 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. 17*/ 18'use strict'; 19if('undefined' !== typeof Module){ // presumably an Emscripten build 20 /** 21 Install a suitable default configuration for sqlite3ApiBootstrap(). 22 */ 23 const SABC = self.sqlite3ApiBootstrap.defaultConfig; 24 SABC.Module = Module /* ==> Currently needs to be exposed here for test code. NOT part 25 of the public API. */; 26 SABC.exports = Module['asm']; 27 SABC.memory = Module.wasmMemory /* gets set if built with -sIMPORT_MEMORY */; 28 29 /** 30 For current (2022-08-22) purposes, automatically call 31 sqlite3ApiBootstrap(). That decision will be revisited at some 32 point, as we really want client code to be able to call this to 33 configure certain parts. Clients may modify 34 self.sqlite3ApiBootstrap.defaultConfig to tweak the default 35 configuration used by a no-args call to sqlite3ApiBootstrap(). 36 */ 37 //console.warn("self.sqlite3ApiConfig = ",self.sqlite3ApiConfig); 38 const sqlite3 = self.sqlite3ApiBootstrap(); 39 delete self.sqlite3ApiBootstrap; 40 41 if(self.location && +self.location.port > 1024){ 42 console.warn("Installing sqlite3 bits as global S for dev-testing purposes."); 43 self.S = sqlite3; 44 } 45 46 /* Clean up temporary references to our APIs... */ 47 delete sqlite3.capi.util /* arguable, but these are (currently) internal-use APIs */; 48 //console.warn("Module.sqlite3 =",Module.sqlite3); 49 Module.sqlite3 = sqlite3 /* Currently needed by test code and sqlite3-worker1.js */; 50}else{ 51 console.warn("This is not running in an Emscripten module context, so", 52 "self.sqlite3ApiBootstrap() is _not_ being called due to lack", 53 "of config info for the WASM environment.", 54 "It must be called manually."); 55} 56