mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-16 12:42:06 +00:00
win.once() instead of win.on
This commit is contained in:
@ -41,7 +41,7 @@ module.exports = (winImport) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
//set menu visibility on load
|
//set menu visibility on load
|
||||||
win.webContents.on("did-finish-load", () => {
|
win.webContents.once("did-finish-load", () => {
|
||||||
// fix bug with menu not applying on start when no internet connection available
|
// fix bug with menu not applying on start when no internet connection available
|
||||||
setMenuVisibility(!config.get("options.hideMenu"));
|
setMenuVisibility(!config.get("options.hideMenu"));
|
||||||
});
|
});
|
||||||
|
|||||||
@ -24,7 +24,7 @@ module.exports = win => {
|
|||||||
const {playPause, next, previous} = getSongControls(win);
|
const {playPause, next, previous} = getSongControls(win);
|
||||||
|
|
||||||
// If the page is ready, register the callback
|
// If the page is ready, register the callback
|
||||||
win.on('ready-to-show', () => {
|
win.once('ready-to-show', () => {
|
||||||
registerCallback(songInfo => {
|
registerCallback(songInfo => {
|
||||||
// Wait for song to start before setting thumbar
|
// Wait for song to start before setting thumbar
|
||||||
if (songInfo.title === '') {
|
if (songInfo.title === '') {
|
||||||
|
|||||||
@ -63,7 +63,7 @@ module.exports = (win) => {
|
|||||||
const { playPause, next, previous, like, dislike } = getSongControls(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.once("ready-to-show", () => {
|
||||||
controls = [previous, playPause, next, like, dislike];
|
controls = [previous, playPause, next, like, dislike];
|
||||||
|
|
||||||
// Register the callback
|
// Register the callback
|
||||||
|
|||||||
@ -43,7 +43,7 @@ module.exports.fileExists = (path, callbackIfExists) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
module.exports.injectCSS = (webContents, filepath, cb = undefined) => {
|
module.exports.injectCSS = (webContents, filepath, cb = undefined) => {
|
||||||
webContents.on("did-finish-load", async () => {
|
webContents.once("did-finish-load", async () => {
|
||||||
await webContents.insertCSS(fs.readFileSync(filepath, "utf8"));
|
await webContents.insertCSS(fs.readFileSync(filepath, "utf8"));
|
||||||
if (cb) {
|
if (cb) {
|
||||||
cb();
|
cb();
|
||||||
|
|||||||
Reference in New Issue
Block a user