[WebNowPlaying] Minor code cleanup
This commit is contained in:
parent
e2ef7afbba
commit
fb4ee6334e
1 changed files with 6 additions and 6 deletions
|
@ -53,7 +53,7 @@ export default class WebNowPlaying {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sendSongInfo(attributes: any) {
|
private sendSongInfo(attributes: any) {
|
||||||
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) return;
|
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) return;
|
||||||
|
|
||||||
const fields = ['STATE', 'TITLE', 'ARTIST', 'ALBUM', 'COVER', 'DURATION', 'POSITION', 'VOLUME', 'REPEAT', 'SHUFFLE'];
|
const fields = ['STATE', 'TITLE', 'ARTIST', 'ALBUM', 'COVER', 'DURATION', 'POSITION', 'VOLUME', 'REPEAT', 'SHUFFLE'];
|
||||||
|
@ -102,7 +102,7 @@ export default class WebNowPlaying {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fireEvent(evt: any) {
|
private fireEvent(evt: any) {
|
||||||
if (!evt.data) return;
|
if (!evt.data) return;
|
||||||
let value = '';
|
let value = '';
|
||||||
if (evt.data.split(/ (.+)/).length > 1) {
|
if (evt.data.split(/ (.+)/).length > 1) {
|
||||||
|
@ -156,7 +156,7 @@ export default class WebNowPlaying {
|
||||||
* Runs on app ready
|
* Runs on app ready
|
||||||
*/
|
*/
|
||||||
@WebNowPlaying.windowsOnly
|
@WebNowPlaying.windowsOnly
|
||||||
onReady(win: any) {
|
public onReady(win: any) {
|
||||||
this._win = win;
|
this._win = win;
|
||||||
|
|
||||||
// Connect to Rainmeter plugin and retry on disconnect.
|
// Connect to Rainmeter plugin and retry on disconnect.
|
||||||
|
@ -212,7 +212,7 @@ export default class WebNowPlaying {
|
||||||
* Runs on app stop
|
* Runs on app stop
|
||||||
*/
|
*/
|
||||||
@WebNowPlaying.windowsOnly
|
@WebNowPlaying.windowsOnly
|
||||||
onBeforeQuit() {
|
public onBeforeQuit() {
|
||||||
if (this.ws) {
|
if (this.ws) {
|
||||||
this.ws.send('STATE:0');
|
this.ws.send('STATE:0');
|
||||||
this.ws.onclose = null; // disable onclose handler first to stop it from retrying
|
this.ws.onclose = null; // disable onclose handler first to stop it from retrying
|
||||||
|
@ -229,7 +229,7 @@ export default class WebNowPlaying {
|
||||||
* @param attributes Music Attributes (attributes.status = current state)
|
* @param attributes Music Attributes (attributes.status = current state)
|
||||||
*/
|
*/
|
||||||
@WebNowPlaying.windowsOnly
|
@WebNowPlaying.windowsOnly
|
||||||
onPlaybackStateDidChange(attributes: any) {
|
public onPlaybackStateDidChange(attributes: any) {
|
||||||
this.sendSongInfo(attributes);
|
this.sendSongInfo(attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ export default class WebNowPlaying {
|
||||||
* @param attributes Music Attributes
|
* @param attributes Music Attributes
|
||||||
*/
|
*/
|
||||||
@WebNowPlaying.windowsOnly
|
@WebNowPlaying.windowsOnly
|
||||||
onNowPlayingItemDidChange(attributes: any) {
|
public onNowPlayingItemDidChange(attributes: any) {
|
||||||
this.sendSongInfo(attributes);
|
this.sendSongInfo(attributes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue