aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api/extern-post-js.c-pp.js
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2023-01-27 03:18:16 +0000
committerstephan <stephan@noemail.net>2023-01-27 03:18:16 +0000
commita0013fbe879fb59843c69610af56b5b9141c9614 (patch)
tree745f6a4773549b0e3956276f9b53ec560eaa7666 /ext/wasm/api/extern-post-js.c-pp.js
parent67bfea4ea6fb3bba1425079301727d350132cde0 (diff)
downloadsqlite-a0013fbe879fb59843c69610af56b5b9141c9614.tar.gz
sqlite-a0013fbe879fb59843c69610af56b5b9141c9614.zip
More work on creating a separate sqlite3.js build which is hopefully friendly to JS bundlers.
FossilOrigin-Name: b7b896fb448a7f46eb88eadadb1359255aec637a384cabcdd526276a02f4f0b4
Diffstat (limited to 'ext/wasm/api/extern-post-js.c-pp.js')
-rw-r--r--ext/wasm/api/extern-post-js.c-pp.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/ext/wasm/api/extern-post-js.c-pp.js b/ext/wasm/api/extern-post-js.c-pp.js
index 87d99eaba..691ad7685 100644
--- a/ext/wasm/api/extern-post-js.c-pp.js
+++ b/ext/wasm/api/extern-post-js.c-pp.js
@@ -45,14 +45,23 @@ const toExportForES6 =
moduleScript: self?.document?.currentScript,
isWorker: ('undefined' !== typeof WorkerGlobalScope),
location: self.location,
- urlParams: new URL(self.location.href).searchParams
+ urlParams:
+//#if target=es6-bundler-friendly
+ undefined
+//#else
+ new URL(self.location.href).searchParams
+//#endif
});
initModuleState.debugModule =
- (new URL(self.location.href).searchParams).has('sqlite3.debugModule')
+//#if target=es6-bundler-friendly
+ ()=>{}
+//#else
+ (new URL(self.location.href).searchParams).has('sqlite3.debugModule')
? (...args)=>console.warn('sqlite3.debugModule:',...args)
: ()=>{};
+//#endif
- if(initModuleState.urlParams.has('sqlite3.dir')){
+ if(initModuleState.urlParams && initModuleState.urlParams.has('sqlite3.dir')){
initModuleState.sqlite3Dir = initModuleState.urlParams.get('sqlite3.dir') +'/';
}else if(initModuleState.moduleScript){
const li = initModuleState.moduleScript.src.split('/');