diff options
author | stephan <stephan@noemail.net> | 2023-03-07 19:12:06 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2023-03-07 19:12:06 +0000 |
commit | 4214cc32ba2082b90dde97495058c45920235bf4 (patch) | |
tree | 1728d17a0729bdbd450e11bf0eecb4c02ca06691 /ext/wasm/common/whwasmutil.js | |
parent | 7272f6d64d88da451f18aa515db06ed6f2b459d4 (diff) | |
download | sqlite-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/common/whwasmutil.js')
-rw-r--r-- | ext/wasm/common/whwasmutil.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/wasm/common/whwasmutil.js b/ext/wasm/common/whwasmutil.js index e50210206..489979941 100644 --- a/ext/wasm/common/whwasmutil.js +++ b/ext/wasm/common/whwasmutil.js @@ -45,8 +45,8 @@ Intended usage: ``` - self.WhWasmUtilInstaller(appObject); - delete self.WhWasmUtilInstaller; + globalThis.WhWasmUtilInstaller(appObject); + delete globalThis.WhWasmUtilInstaller; ``` Its global-scope symbol is intended only to provide an easy way to @@ -171,7 +171,7 @@ https://fossil.wanderinghorse.net/r/jaccwabbyt/file/common/whwasmutil.js */ -self.WhWasmUtilInstaller = function(target){ +globalThis.WhWasmUtilInstaller = function(target){ 'use strict'; if(undefined===target.bigIntEnabled){ target.bigIntEnabled = !!self['BigInt64Array']; @@ -2194,7 +2194,7 @@ self.WhWasmUtilInstaller = function(target){ Error handling is up to the caller, who may attach a `catch()` call to the promise. */ -self.WhWasmUtilInstaller.yawl = function(config){ +globalThis.WhWasmUtilInstaller.yawl = function(config){ const wfetch = ()=>fetch(config.uri, {credentials: 'same-origin'}); const wui = this; const finalThen = function(arg){ @@ -2240,4 +2240,4 @@ self.WhWasmUtilInstaller.yawl = function(config){ .then(finalThen); }; return loadWasm; -}.bind(self.WhWasmUtilInstaller)/*yawl()*/; +}.bind(globalThis.WhWasmUtilInstaller)/*yawl()*/; |