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.

at v4 58 lines 1.4 kB view raw
1import { defineElement, DiffuseElement } from "~/common/element.js"; 2import { SCHEME } from "./constants.js"; 3 4/** 5 * @import { InputActions, InputSchemeProvider } from "~/components/input/types.d.ts" 6 * @import { ProxiedActions } from "~/common/worker.d.ts" 7 * @import { Track } from "~/definitions/types.d.ts" 8 */ 9 10//////////////////////////////////////////// 11// ELEMENT 12//////////////////////////////////////////// 13 14/** 15 * @implements {ProxiedActions<InputActions>} 16 * @implements {InputSchemeProvider} 17 */ 18class EphemeralCacheInput extends DiffuseElement { 19 static NAME = "diffuse/input/ephemeral-cache"; 20 static WORKER_URL = "components/input/ephemeral-cache/worker.js"; 21 22 SCHEME = SCHEME; 23 24 constructor() { 25 super(); 26 27 /** @type {ProxiedActions<InputActions>} */ 28 const proxy = this.workerProxy(); 29 30 this.artwork = proxy.artwork; 31 this.consult = proxy.consult; 32 this.detach = proxy.detach; 33 this.groupConsult = proxy.groupConsult; 34 this.list = proxy.list; 35 this.resolve = proxy.resolve; 36 } 37 38 // 🛠️ 39 40 /** @param {Track[]} tracks */ 41 sources(tracks) { 42 return tracks.map((t) => ({ 43 label: t.uri, 44 uri: t.uri, 45 })); 46 } 47} 48 49export default EphemeralCacheInput; 50 51//////////////////////////////////////////// 52// REGISTER 53//////////////////////////////////////////// 54 55export const CLASS = EphemeralCacheInput; 56export const NAME = "di-ephemeral-cache"; 57 58defineElement(NAME, CLASS);