aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api/extern-post-js.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/wasm/api/extern-post-js.js')
-rw-r--r--ext/wasm/api/extern-post-js.js20
1 files changed, 11 insertions, 9 deletions
diff --git a/ext/wasm/api/extern-post-js.js b/ext/wasm/api/extern-post-js.js
index acf7068fe..cace6ed51 100644
--- a/ext/wasm/api/extern-post-js.js
+++ b/ext/wasm/api/extern-post-js.js
@@ -13,19 +13,20 @@ const toExportForES6 =
//#endif
(function(){
/**
- In order to hide the sqlite3InitModule()'s resulting Emscripten
- module from downstream clients (and simplify our documentation by
- being able to elide those details), we rewrite
- sqlite3InitModule() to return the sqlite3 object.
+ In order to hide the sqlite3InitModule()'s resulting
+ Emscripten module from downstream clients (and simplify our
+ documentation by being able to elide those details), we hide that
+ function and expose a hand-written sqlite3InitModule() to return
+ the sqlite3 object (most of the time).
Unfortunately, we cannot modify the module-loader/exporter-based
impls which Emscripten installs at some point in the file above
this.
*/
const originalInit =
- /*Maintenance reminde: DO NOT use `self.` here. It's correct
- for non-ES6 Module cases but wrong for ES6 modules because those
- resolve this symbol differently! */ sqlite3InitModule;
+ /* Maintenance reminder: DO NOT use `self.` here. It's correct
+ for non-ES6 Module cases but wrong for ES6 modules because those
+ resolve this symbol differently. */ sqlite3InitModule;
if(!originalInit){
throw new Error("Expecting self.sqlite3InitModule to be defined by the Emscripten build.");
}
@@ -104,10 +105,11 @@ const toExportForES6 =
}
/* Replace the various module exports performed by the Emscripten
glue... */
- if (typeof exports === 'object' && typeof module === 'object')
+ if (typeof exports === 'object' && typeof module === 'object'){
module.exports = sqlite3InitModule;
- else if (typeof exports === 'object')
+ }else if (typeof exports === 'object'){
exports["sqlite3InitModule"] = sqlite3InitModule;
+ }
/* AMD modules get injected in a way we cannot override,
so we can't handle those here. */
return self.sqlite3InitModule /* required for ESM */;