Build
Foundation
Diffuse comes with a foundation that preconfigures all elements so you don't have to set them up yourself, along with a combination of elements for certain features. It internally tracks the DOM addition of the custom elements, so no need to worry about setting up an element multiple times.
Refer to the elements index to find out what each element does.
import foundation from "common/foundation.js"
await foundation.configurator.input()
await foundation.configurator.scrobbles()
await foundation.engine.audio()
await foundation.engine.queue()
await foundation.engine.repeatShuffle()
await foundation.engine.scope()
await foundation.orchestrator.autoQueue()
await foundation.orchestrator.favourites()
await foundation.orchestrator.mediaSession()
await foundation.orchestrator.output()
await foundation.orchestrator.queueAudio()
await foundation.orchestrator.processTracks()
await foundation.orchestrator.scopedTracks()
await foundation.orchestrator.scrobbleAudio()
await foundation.orchestrator.sources()
await foundation.processor.artwork()
await foundation.processor.metadata()
await foundation.processor.search()
Examples
Some simple examples to help you understand how to build your own facet. Click the edit button to load them into the code editor above.
-
Shows what's currently set to "now playing" in the queue, along with a button to shift the queue to the next track.
-
Make a list of what previously played in the queue.
Notes
While you have the ability to do whatever you want in a custom facet, the existing facets are designed to work a certain way; so here's some things to keep in mind:
- Most elements are configured in broadcast mode so they communicate across tabs. There are a few exceptions such as inputs, where we prefer parallelisation.