mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-04-03 14:20:50 +08:00
38 lines
861 B
JavaScript
38 lines
861 B
JavaScript
const { BrowserWindow } = require('electron');
|
|
|
|
let lyricWindow = null;
|
|
|
|
const loadLyricWindow = (ipcMain) => {
|
|
lyricWindow = new BrowserWindow({
|
|
width: 800,
|
|
height: 300,
|
|
frame: false,
|
|
show: false,
|
|
transparent: true,
|
|
webPreferences: {
|
|
nodeIntegration: true,
|
|
preload: `${__dirname}/preload.js`,
|
|
contextIsolation: false,
|
|
},
|
|
});
|
|
|
|
ipcMain.on('open-lyric', () => {
|
|
if (process.env.NODE_ENV === 'development') {
|
|
lyricWindow.webContents.openDevTools({ mode: 'detach' });
|
|
lyricWindow.loadURL('http://localhost:4678/#/lyric');
|
|
} else {
|
|
lyricWindow.loadURL(`file://${__dirname}/dist/index.html/#/lyric`);
|
|
}
|
|
|
|
lyricWindow.show();
|
|
});
|
|
|
|
ipcMain.on('send-lyric', (e, data) => {
|
|
lyricWindow.webContents.send('receive-lyric', data);
|
|
});
|
|
};
|
|
|
|
module.exports = {
|
|
loadLyricWindow,
|
|
};
|