mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
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
This commit is contained in:
@ -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...
|
||||
|
||||
|
Reference in New Issue
Block a user