diff options
author | stephan <stephan@noemail.net> | 2022-09-30 11:01:44 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2022-09-30 11:01:44 +0000 |
commit | f6c686c9f4dc33c66e103d0af437aaf5ae2c20b6 (patch) | |
tree | 3b34e6d2ccb202bcb4f7db83893e0fc5e5885879 /ext/wasm/api/sqlite3-api-oo1.js | |
parent | 53d4e01d063ebee14ff06706b58faba0d07df136 (diff) | |
download | sqlite-f6c686c9f4dc33c66e103d0af437aaf5ae2c20b6.tar.gz sqlite-f6c686c9f4dc33c66e103d0af437aaf5ae2c20b6.zip |
Add oo1.JsStorageDb() as a convenience wrapper for oo1.DB(...,'kvvfs'). Minor doc cleanups.
FossilOrigin-Name: 8a7998709f859a562cf6829485cb9921f8823af0efabe003741348ab1169fb89
Diffstat (limited to 'ext/wasm/api/sqlite3-api-oo1.js')
-rw-r--r-- | ext/wasm/api/sqlite3-api-oo1.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/ext/wasm/api/sqlite3-api-oo1.js b/ext/wasm/api/sqlite3-api-oo1.js index 4f7ffe1cd..1daf6eb00 100644 --- a/ext/wasm/api/sqlite3-api-oo1.js +++ b/ext/wasm/api/sqlite3-api-oo1.js @@ -1638,7 +1638,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ Object.defineProperty(Stmt.prototype, 'pointer', prop); Object.defineProperty(DB.prototype, 'pointer', prop); } - + /** The OO API's public namespace. */ sqlite3.oo1 = { version: { @@ -1650,5 +1650,24 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ dbCtorHelper }/*oo1 object*/; + if(util.isMainWindow()){ + /** + Functionally equivalent to DB(storageName,'c','kvvfs') except + that it throws if the given storage name is not one of 'local' + or 'session'. + */ + sqlite3.oo1.JsStorageDb = function(storageName='session'){ + if('session'!==storageName && 'local'!==storageName){ + toss3("JsStorageDb db name must be one of 'session' or 'local'."); + } + dbCtorHelper.call(this, { + filename: storageName, + flags: 'c', + vfs: "kvvfs" + }); + }; + sqlite3.oo1.JsStorageDb.prototype = Object.create(DB.prototype); + } + }); |