diff --git a/docs/.vitepress/analyzers/mcla.ts b/docs/.vitepress/analyzers/mcla.ts index 1dbc3945..b25c4e80 100644 --- a/docs/.vitepress/analyzers/mcla.ts +++ b/docs/.vitepress/analyzers/mcla.ts @@ -20,7 +20,7 @@ export { loadMCLA, } -const VERSION = "v0.4.22" +const VERSION = "v0.4.23" // const VERSION = "dev" const RESOURCES_BASE = "https://globemc.github.io/mcla" const GO_WASM_EXEC_URL = useCDN(`${RESOURCES_BASE}/${VERSION}/wasm_exec.js`) diff --git a/docs/public/scripts/mcla_worker.js b/docs/public/scripts/mcla_worker.js index fa8e0a7f..1abd2a62 100644 --- a/docs/public/scripts/mcla_worker.js +++ b/docs/public/scripts/mcla_worker.js @@ -44,6 +44,29 @@ class DBStorage { return this._getStore().index("k") } + _openCursor() { + return this._getStore().openCursor() + } + + keys() { + return new Promise((resolve, reject) => { + const keys = [] + const request = this._openCursor() + request.onerror = reject + request.onsuccess = function(event) { + const cursor = event.target.result + if (cursor) { + const key = cursor.primaryKey + console.debug(key, cursor.value) + keys.push(key) + cursor.continue() + } else { + resolve(keys) + } + }; + }) + } + async getItem(key) { const res = (await wrapDBReq(this._getIndex().get(key))).target.result if (res) {