A music player that connects to your cloud/distributed storage. diffuse.sh
Something went wrong. Try again.
1.7 kB · 71 lines
JavaScript
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172import { defineElement, DiffuseElement } from "~/common/element.js";
/** * @import {ProxiedActions, Tunnel} from "~/common/worker.d.ts" * @import {InputElement} from "@specs/components/input/types.d.ts" * @import {Actions} from "@specs/components/configurator/input/types.d.ts" */
/** * @typedef {{ element: InputElement, tunnel: Tunnel, worker: Worker | SharedWorker }} Input */
////////////////////////////////////////////// ELEMENT////////////////////////////////////////////
/** * @implements {ProxiedActions<Actions>} */class InputConfigurator extends DiffuseElement { static NAME = "diffuse/configurator/input"; static WORKER_URL = "components/configurator/input/worker.js";
constructor() { super();
/** @type {ProxiedActions<Actions>} */ const proxy = this.workerProxy();
this.artwork = proxy.artwork; this.consult = proxy.consult; this.detach = proxy.detach; this.groupConsult = proxy.groupConsult; this.list = proxy.list; this.resolve = proxy.resolve;
this.cache = proxy.cache; this.cacheBlob = proxy.cacheBlob; this.listCached = proxy.listCached; this.removeFromCache = proxy.removeFromCache; }
// WORKERS
/** * @override */ dependencies() { return this.inputs(); }
inputs() { return Object.fromEntries( Array.from(this.children).map((element) => { const input = /** @type {InputElement} */ (element); return [input.SCHEME, input]; }), ); }}
export default InputConfigurator;
////////////////////////////////////////////// REGISTER////////////////////////////////////////////
export const CLASS = InputConfigurator;export const NAME = "dc-input";
defineElement(NAME, CLASS);