Skip to content

Events

Components ask for things by firing events. main.js (or a dedicated component) listens on document and does the work. That's why a track list can play music without knowing the player exists.

Event (events.js) Detail Handled by
nessie:play { trackIds, start } main.js → player.play()
nessie:enqueue { trackIds, next } main.js → player.enqueue()
nessie:play-collection { kind: album|playlist|smart, … } main.js fetches the songs, then plays them
nessie:add-to-playlist { trackIds, label, name? } nessie-playlist-picker
nessie:toast { text, variant } nessie-toasts (use the toast() helper)
nessie:list-move, nessie:list-remove { item, from, to }, { item, index } The playlist view, which tells the server
nessie:libraries-changed main.js reloads the sidebar's libraries
nessie:playlists-changed main.js redraws a playlist view on screen
nessie:server-settings-changed integrations.js and ai-prompt.js ask the server again
nessie:choose-profile main.js shows the profile picker (fired by api.js on any 401)

Shared state that several components watch lives in small modules, each with its own EventTarget:

  • nowPlaying (events.js): the current track id, used to highlight rows.
  • identityEvents (identity.js): the profile changed.
  • integrationEvents (integrations.js): Lidarr turned on or off.
  • The Player's own state, output and message events.
  • live (live.js): what the server says changed (see Live updates).