aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api/sqlite3-api-glue.js
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2023-03-07 19:12:06 +0000
committerstephan <stephan@noemail.net>2023-03-07 19:12:06 +0000
commit4214cc32ba2082b90dde97495058c45920235bf4 (patch)
tree1728d17a0729bdbd450e11bf0eecb4c02ca06691 /ext/wasm/api/sqlite3-api-glue.js
parent7272f6d64d88da451f18aa515db06ed6f2b459d4 (diff)
downloadsqlite-4214cc32ba2082b90dde97495058c45920235bf4.tar.gz
sqlite-4214cc32ba2082b90dde97495058c45920235bf4.zip
Replace use of 'self' in JS code with 'globalThis', as that works in browsers and node environments. Avoid using globalThis.location if it's not set (e.g. in node). Based on feedback in [forum:ac7a94d4f77db235|forum post ac7a94d4f77db235]. Minor JS build tweaks.
FossilOrigin-Name: dbbe8f25e58738c10b6192d41f1e3886983871f17631cbc45ce626d3f05a6e26
Diffstat (limited to 'ext/wasm/api/sqlite3-api-glue.js')
-rw-r--r--ext/wasm/api/sqlite3-api-glue.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/wasm/api/sqlite3-api-glue.js b/ext/wasm/api/sqlite3-api-glue.js
index 7db23bacc..1cb00b941 100644
--- a/ext/wasm/api/sqlite3-api-glue.js
+++ b/ext/wasm/api/sqlite3-api-glue.js
@@ -16,13 +16,13 @@
initializes the main API pieces so that the downstream components
(e.g. sqlite3-api-oo1.js) have all that they need.
*/
-self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
+globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
'use strict';
const toss = (...args)=>{throw new Error(args.join(' '))};
const toss3 = sqlite3.SQLite3Error.toss;
const capi = sqlite3.capi, wasm = sqlite3.wasm, util = sqlite3.util;
- self.WhWasmUtilInstaller(wasm);
- delete self.WhWasmUtilInstaller;
+ globalThis.WhWasmUtilInstaller(wasm);
+ delete globalThis.WhWasmUtilInstaller;
if(0){
/**
@@ -605,7 +605,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
/**
Install JS<->C struct bindings for the non-opaque struct types we
need... */
- sqlite3.StructBinder = self.Jaccwabyt({
+ sqlite3.StructBinder = globalThis.Jaccwabyt({
heap: 0 ? wasm.memory : wasm.heap8u,
alloc: wasm.alloc,
dealloc: wasm.dealloc,
@@ -613,7 +613,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
memberPrefix: /* Never change this: this prefix is baked into any
amount of code and client-facing docs. */ '$'
});
- delete self.Jaccwabyt;
+ delete globalThis.Jaccwabyt;
{// wasm.xWrap() bindings...