1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

More experimentation with how client-side config state can be passed on to initialize the JS-side sqlite3 API.

FossilOrigin-Name: ea2acc454c012a62556f6d0623d6eff60736d24aa214a64462b423623ef44d47
This commit is contained in:
stephan
2022-08-22 21:37:17 +00:00
parent 7a8a0fceec
commit ae708b2b01
7 changed files with 81 additions and 38 deletions

View File

@ -168,6 +168,33 @@
}
f.ui.status.classList.add('hidden');
}
},
/**
Config options used by the Emscripten-dependent initialization
which happens via this.initSqlite3(). This object gets
(indirectly) passed to sqlite3ApiBootstrap() to configure the
sqlite3 API.
*/
sqlite3ApiConfig: {
persistentDirName: "/persistent"
},
/**
Intended to be called by apps which need to call the
Emscripten-installed sqlite3InitModule() routine. This function
temporarily installs this.sqlite3ApiConfig into the self
object, calls it sqlite3InitModule(), and removes
self.sqlite3ApiConfig after initialization is done. Returns the
promise from sqlite3InitModule(), and the next then() handler
will get the Emscripten module object as its argument. That
module has the sqlite3's main namespace object installed as its
`sqlite3` property.
*/
initSqlite3: function(){
self.sqlite3ApiConfig = this.sqlite3ApiConfig;
return self.sqlite3InitModule(this).then(function(M){
delete self.sqlite3ApiConfig;
return M;
});
}
};
})(self/*window or worker*/);