app: ipfs loading improvements:

use IPFSClient from wabac.js
app: remove # from ipfs paths sent to app
preload interface made more extensible
This commit is contained in:
Ilya Kreymer
2020-12-09 22:46:16 -08:00
parent dfdebe9f69
commit cd40979625
7 changed files with 72 additions and 78 deletions
+10 -4
View File
@@ -10,18 +10,22 @@ const dbs = {};
const loader = new CollectionLoader();
async function getDB(name) {
async function getColl(name) {
if (!dbs[name]) {
dbs[name] = await loader.loadColl(name);
console.log(dbs[name]);
await dbs[name].initing;
}
return dbs[name].store;
return dbs[name];
}
async function getDB(name) {
const coll = await getColl(name);
return coll.store;
}
async function getResponse(event, request, coll, ts, channel) {
const db = await getDB(coll);
await db.initing;
const req = {request, url: request.url, timestamp: ts};
@@ -41,6 +45,8 @@ async function getResponse(event, request, coll, ts, channel) {
ipcRenderer.on('getresponse', getResponse);
export { getDB, getColl, loader };