mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-10 10:11:46 +00:00
27 lines
613 B
JavaScript
27 lines
613 B
JavaScript
const path = require("path");
|
|
|
|
const { injectCSS, listenAction } = require("../utils");
|
|
const { ACTIONS, CHANNEL } = require("./actions.js");
|
|
|
|
function handle(win) {
|
|
injectCSS(win.webContents, path.join(__dirname, "style.css"));
|
|
listenAction(CHANNEL, (event, action) => {
|
|
switch (action) {
|
|
case ACTIONS.NEXT:
|
|
if (win.webContents.canGoForward()) {
|
|
win.webContents.goForward();
|
|
}
|
|
break;
|
|
case ACTIONS.BACK:
|
|
if (win.webContents.canGoBack()) {
|
|
win.webContents.goBack();
|
|
}
|
|
break;
|
|
default:
|
|
console.log("Unknown action: " + action);
|
|
}
|
|
});
|
|
}
|
|
|
|
module.exports = handle;
|