diff options
author | stephan <stephan@noemail.net> | 2022-09-26 11:38:58 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2022-09-26 11:38:58 +0000 |
commit | 1f095d482d1803deb9fcb60449e9ca1223018d73 (patch) | |
tree | ee83c502c48008460a89a0aaab2adcc728c7c69b /ext/wasm/api/sqlite3-api-opfs.js | |
parent | 6a643e4bcdc81f835be75377d1c6306f5e23f541 (diff) | |
download | sqlite-1f095d482d1803deb9fcb60449e9ca1223018d73.tar.gz sqlite-1f095d482d1803deb9fcb60449e9ca1223018d73.zip |
Get fiddle db export working for OPFS VFS. Add root dir handle to the main OPFS VFS worker to enable creation of certain utility functions without delegating to the async worker. Add sqlite3.capi.sqlite3_wasm_rc_str() to map integer result codes back to their SQLITE_xxx counterparts. Minor doc touchups.
FossilOrigin-Name: 9b2244e1c8a40efe6547094a1b57acc8f2173145a8731abb0e36268ce0a8ef41
Diffstat (limited to 'ext/wasm/api/sqlite3-api-opfs.js')
-rw-r--r-- | ext/wasm/api/sqlite3-api-opfs.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/ext/wasm/api/sqlite3-api-opfs.js b/ext/wasm/api/sqlite3-api-opfs.js index f69e162c7..2c22c03f7 100644 --- a/ext/wasm/api/sqlite3-api-opfs.js +++ b/ext/wasm/api/sqlite3-api-opfs.js @@ -999,11 +999,14 @@ sqlite3.installOpfsVfs = function callee(asyncProxyUri = callee.defaultProxyUri) warn("Running sanity checks because of opfs-sanity-check URL arg..."); sanityCheck(); } - W.onerror = W._originalOnError; - delete W._originalOnError; - sqlite3.opfs = opfsUtil; - log("End of OPFS sqlite3_vfs setup.", opfsVfs); - promiseResolve(sqlite3); + navigator.storage.getDirectory().then((d)=>{ + W.onerror = W._originalOnError; + delete W._originalOnError; + sqlite3.opfs = opfsUtil; + opfsUtil.rootDirectory = d; + log("End of OPFS sqlite3_vfs setup.", opfsVfs); + promiseResolve(sqlite3); + }); }catch(e){ error(e); promiseReject(e); |