mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-16 20:52:06 +00:00
Use refactored providers in touchbar plugin
This commit is contained in:
@ -7,6 +7,9 @@ const {
|
|||||||
TouchBarScrubber,
|
TouchBarScrubber,
|
||||||
} = TouchBar;
|
} = TouchBar;
|
||||||
|
|
||||||
|
const getSongInfo = require("../../providers/song-info");
|
||||||
|
const getSongControls = require("../../providers/song-controls");
|
||||||
|
|
||||||
// Songtitle label
|
// Songtitle label
|
||||||
const songTitle = new TouchBarLabel({
|
const songTitle = new TouchBarLabel({
|
||||||
label: "",
|
label: "",
|
||||||
@ -55,19 +58,16 @@ const touchBar = new TouchBar({
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = win => {
|
module.exports = (win) => {
|
||||||
|
const registerCallback = getSongInfo(win);
|
||||||
|
const { playPause, next, previous, like, dislike } = getSongControls(win);
|
||||||
|
|
||||||
// If the page is ready, register the callback
|
// If the page is ready, register the callback
|
||||||
win.on('ready-to-show', () => {
|
win.on("ready-to-show", () => {
|
||||||
controls = [
|
controls = [previous, playPause, next, like, dislike];
|
||||||
global.songControls.previous,
|
|
||||||
global.songControls.pause,
|
|
||||||
global.songControls.next,
|
|
||||||
global.songControls.like,
|
|
||||||
global.songControls.dislike
|
|
||||||
];
|
|
||||||
|
|
||||||
// Register the callback
|
// Register the callback
|
||||||
global.songInfo.onNewData(songInfo => {
|
registerCallback((songInfo) => {
|
||||||
// Song information changed, so lets update the touchBar
|
// Song information changed, so lets update the touchBar
|
||||||
|
|
||||||
// Set the song title
|
// Set the song title
|
||||||
|
|||||||
Reference in New Issue
Block a user