Skip to content

Commit

Permalink
feat: listen for queue set & get messages
Browse files Browse the repository at this point in the history
  • Loading branch information
cdrani committed May 15, 2024
1 parent f567b8b commit 14b7aa1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { setState, getState } from './utils/state.js'
import { mediaKeys, chorusKeys } from './utils/selectors.js'
import { activeOpenTab, sendMessage } from './utils/messaging.js'

import { getQueueList, setQueueList } from './services/queue.js'
import { createArtistDiscoPlaylist } from './services/artist-disco.js'
import { playSharedTrack, seekTrackToPosition } from './services/player.js'

Expand Down Expand Up @@ -140,6 +141,8 @@ function promiseHandler(promise, sendResponse) {

chrome.runtime.onMessage.addListener(({ key, values }, _, sendResponse) => {
const messageHandler = {
'queue.set': setQueueList,
'queue.get': getQueueList,
'play.shared': playSharedTrack,
'play.seek': seekTrackToPosition,
'artist.disco': createArtistDiscoPlaylist,
Expand Down
2 changes: 2 additions & 0 deletions src/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ window.addEventListener('message', async (event) => {
const messageHandlers = {
'play.seek': sendBackgroundMessage,
'play.shared': sendBackgroundMessage,
'queue.set' : sendBackgroundMessage,
'queue.get' : sendBackgroundMessage,
'artist.disco': sendBackgroundMessage,
'storage.populate': () => getState(null),
'storage.get': ({ key }) => getState(key),
Expand Down

0 comments on commit 14b7aa1

Please sign in to comment.