Repository navigation
Expand file tree
/
Copy pathindex.frontend.js
More file actions
60 lines (48 loc) · 1.64 KB
/
Copy pathindex.frontend.js
File metadata and controls
60 lines (48 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
class LyricsWindowFrontend {
constructor() {
// Setting up a ipcRenderer channel for back end to communicate with
// ipcRenderer.on("plugin.backendComm", (event, message) => {
// // Alert popup
// bootbox.alert(`Backend says: ${message}`)
// })
app.$watch('lyrics', function (newVal, oldVal) {
LyricsWindowPlugin.updateLyrics(newVal)
}, {
deep: true
})
app.$watch('richlyrics', function (newVal, oldVal) {
LyricsWindowPlugin.updateRichLyrics(newVal)
})
app.$watch('currentArtUrl', function (newVal, oldVal) {
LyricsWindowPlugin.updateBGArtwork(newVal)
})
app.$watch('activeCasts', function (newVal, oldVal) {
let airPlay = newVal[0]?.hasOwnProperty('airplay2') ?? false
LyricsWindowPlugin.checkAirPlay(airPlay)
}, {
deep: true
})
const menuEntry = new CiderFrontAPI.Objects.MenuEntry()
menuEntry.name = "Toggle Lyrics Window"
menuEntry.onClick = ()=>{
this.openLyricsWindow()
}
CiderFrontAPI.AddMenuEntry(menuEntry)
}
openLyricsWindow() {
ipcRenderer.send("LyricsWindowOpen", "")
}
updateLyrics(val) {
ipcRenderer.send("LWLyricsUpdate", val)
}
updateRichLyrics(val) {
ipcRenderer.send("LWRichLyricsUpdate", val)
}
updateBGArtwork(val) {
ipcRenderer.send("LWBGUpdate", val)
}
checkAirPlay(val) {
ipcRenderer.send("LWAirPlayStatus", val)
}
}
const LyricsWindowPlugin = new LyricsWindowFrontend()