1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-09-01 01:02:12 +03:00

Refactor JS API amalgamation such that the bootstrapping/configuration is deferred until the whole amalgamation is available, to facilitate providing clients with a way to initialize the API with their own config (noting that we're still one small level of refactoring away from being able to actually do that).

FossilOrigin-Name: 9dbe9a6aecec43b51057375ef1d2d632db0d17eac8b7552c20cc91fc2f1a55d1
This commit is contained in:
stephan
2022-08-22 13:34:13 +00:00
parent 64d04a8d9f
commit e3cd67603d
9 changed files with 206 additions and 107 deletions

View File

@@ -31,12 +31,13 @@
// FileSystemDirectoryHandle
// FileSystemFileHandle
// FileSystemFileHandle.prototype.createSyncAccessHandle
self.sqlite3.postInit.push(function(self, sqlite3){
self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
const warn = console.warn.bind(console),
error = console.error.bind(console);
if(!self.importScripts || !self.FileSystemFileHandle
|| !self.FileSystemFileHandle.prototype.createSyncAccessHandle){
warn("OPFS not found or its sync API is not available in this environment.");
if(!self.importScripts || !self.FileSystemFileHandle){
//|| !self.FileSystemFileHandle.prototype.createSyncAccessHandle){
// ^^^ sync API is not required with WASMFS/OPFS backend.
warn("OPFS is not available in this environment.");
return;
}else if(!sqlite3.capi.wasm.bigIntEnabled){
error("OPFS requires BigInt support but sqlite3.capi.wasm.bigIntEnabled is false.");