mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +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:
@ -134,7 +134,7 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(apiConfig){
|
||||
return sqlite3ApiBootstrap.sqlite3;
|
||||
}
|
||||
|
||||
apiConfig = apiConfig||{};
|
||||
apiConfig = apiConfig || {};
|
||||
const config = Object.create(null);
|
||||
{
|
||||
const configDefaults = {
|
||||
@ -147,9 +147,15 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(apiConfig){
|
||||
persistentDirName: '/persistent'
|
||||
};
|
||||
Object.keys(configDefaults).forEach(function(k){
|
||||
config[k] = Object.prototype.hasOwnProperty.call(apiConfig, k)
|
||||
config[k] = Object.getOwnPropertyDescriptor(apiConfig, k)
|
||||
? apiConfig[k] : configDefaults[k];
|
||||
});
|
||||
// Copy over any properties apiConfig defines but configDefaults does not...
|
||||
Object.keys(apiConfig).forEach(function(k){
|
||||
if(!Object.getOwnPropertyDescriptor(config, k)){
|
||||
config[k] = apiConfig[k];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** Throws a new Error, the message of which is the concatenation
|
||||
|
Reference in New Issue
Block a user