A music player that connects to your cloud/distributed storage.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: don't use worker for idb output

+5 -43
+5 -6
src/components/output/polymorphic/indexed-db/element.js
··· 1 + import * as IDB from "idb-keyval"; 2 + 3 + import { IDB_PREFIX } from "./constants.js"; 1 4 import { DiffuseElement } from "@common/element.js"; 2 5 import { outputManager } from "../../common.js"; 3 6 4 7 /** 5 - * @import {ProxiedActions} from "@common/worker.d.ts" 6 8 * @import {OutputElement, OutputManager, OutputWorkerActions} from "../../types.d.ts" 7 9 * @import {SupportedDataTypes} from "./types.d.ts" 8 10 */ ··· 22 24 23 25 constructor() { 24 26 super(); 25 - 26 - /** @type {ProxiedActions<OutputWorkerActions<SupportedDataTypes>>} */ 27 - this.proxy = this.workerProxy(); 28 27 29 28 /** @type {OutputManager<SupportedDataTypes>} */ 30 29 this.#manager = outputManager({ ··· 62 61 // GET & PUT 63 62 64 63 /** @param {string} name */ 65 - #get = (name) => this.proxy.get({ name: this.#cat(name) }); 64 + #get = (name) => IDB.get(`${IDB_PREFIX}/${this.#cat(name)}`); 66 65 67 66 /** @param {string} name; @param {any} data */ 68 - #put = (name, data) => this.proxy.put({ name: this.#cat(name), data }); 67 + #put = (name, data) => IDB.set(`${IDB_PREFIX}/${this.#cat(name)}`, data); 69 68 70 69 // 🛠️ 71 70
-37
src/components/output/polymorphic/indexed-db/worker.js
··· 1 - import * as IDB from "idb-keyval"; 2 - 3 - import { IDB_PREFIX } from "./constants.js"; 4 - import { ostiary, rpc } from "@common/worker.js"; 5 - 6 - /** 7 - * @import {OutputWorkerActions} from "@components/output/types.d.ts"; 8 - * @import {SupportedDataTypes} from "./types.d.ts" 9 - */ 10 - 11 - //////////////////////////////////////////// 12 - // ACTIONS 13 - //////////////////////////////////////////// 14 - 15 - /** 16 - * @type {OutputWorkerActions<SupportedDataTypes>["get"]} 17 - */ 18 - export async function get({ name }) { 19 - return await IDB.get(`${IDB_PREFIX}/${name}`); 20 - } 21 - 22 - /** 23 - * @type {OutputWorkerActions<SupportedDataTypes>["put"]} 24 - */ 25 - export async function put({ data, name }) { 26 - return await IDB.set(`${IDB_PREFIX}/${name}`, data); 27 - } 28 - //////////////////////////////////////////// 29 - // ⚡️ 30 - //////////////////////////////////////////// 31 - 32 - ostiary((context) => { 33 - rpc(context, { 34 - get, 35 - put, 36 - }); 37 - });