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 61 lines 1.4 kB view raw
1import { defineElement, DiffuseElement, query } from "~/common/element.js"; 2 3/** 4 * @import {ProxiedActions} from "~/common/worker.d.ts" 5 * @import {InputElement} from "~/components/input/types.d.ts" 6 * @import {Actions} from "~/components/metadata/types.d.ts" 7 */ 8 9//////////////////////////////////////////// 10// ELEMENT 11//////////////////////////////////////////// 12 13/** 14 * @implements {ProxiedActions<Actions>} 15 */ 16class AudioFileMetadata extends DiffuseElement { 17 static NAME = "diffuse/metadata/audio-file"; 18 static WORKER_URL = "components/metadata/audio-file/worker.js"; 19 20 constructor() { 21 super(); 22 23 /** @type {ProxiedActions<Actions>} */ 24 const p = this.workerProxy(); 25 26 this.patch = p.patch; 27 } 28 29 // LIFECYCLE 30 31 /** @override */ 32 async connectedCallback() { 33 super.connectedCallback(); 34 35 /** @type {InputElement} */ 36 this.input = query(this, "input-selector"); 37 38 await customElements.whenDefined(this.input.localName); 39 } 40 41 // WORKERS 42 43 /** 44 * @override 45 */ 46 dependencies() { 47 if (!this.input) throw new Error("Input element not defined yet"); 48 return { input: this.input }; 49 } 50} 51 52export default AudioFileMetadata; 53 54//////////////////////////////////////////// 55// REGISTER 56//////////////////////////////////////////// 57 58export const CLASS = AudioFileMetadata; 59export const NAME = "dm-audio-file"; 60 61defineElement(NAME, AudioFileMetadata);