1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

wasm refactoring part 2 of (apparently) 2: moved ext/fiddle/... into ext/wasm and restructured the core API-related parts of the JS/WASM considerably.

FossilOrigin-Name: 27f9da4eaaff39d1d58e9ffef7ddccf1e41b3726914f754b920e3e1fb572cba6
This commit is contained in:
stephan
2022-08-10 11:26:08 +00:00
parent 8c3b7501af
commit 3961b26363
35 changed files with 9162 additions and 2902 deletions

View File

@ -0,0 +1,44 @@
/*
2022-07-22
The author disclaims copyright to this source code. In place of a
legal notice, here is a blessing:
* May you do good and not evil.
* May you find forgiveness for yourself and forgive others.
* May you share freely, never taking more than you give.
***********************************************************************
This file is the tail end of the sqlite3-api.js constellation,
intended to be appended after all other files so that it can clean
up any global systems temporarily used for setting up the API's
various subsystems.
*/
'use strict';
self.sqlite3.postInit.forEach(
self.importScripts/*global is a Worker*/
? function(f){
/** We try/catch/report for the sake of failures which happen in
a Worker, as those exceptions can otherwise get completely
swallowed, leading to confusing downstream errors which have
nothing to do with this failure. */
try{ f(self, self.sqlite3) }
catch(e){
console.error("Error in postInit() function:",e);
throw e;
}
}
: (f)=>f(self, self.sqlite3)
);
delete self.sqlite3.postInit;
if(self.location && +self.location.port > 1024){
console.warn("Installing sqlite3 bits as global S for dev-testing purposes.");
self.S = self.sqlite3;
}
/* Clean up temporary global-scope references to our APIs... */
self.sqlite3.config.Module.sqlite3 = self.sqlite3
/* ^^^^ Currently needed by test code and Worker API setup */;
delete self.sqlite3.capi.util /* arguable, but these are (currently) internal-use APIs */;
delete self.sqlite3 /* clean up our global-scope reference */;
//console.warn("Module.sqlite3 =",Module.sqlite3);