gpt4 book ai didi

javascript - Electron/浏览器 : Detect when the app is opened again from taskbar (after being minimized)

转载 作者:行者123 更新时间:2023-12-02 21:07:02 25 4
gpt4 key购买 nike

我正在努力寻找问题的解决方案 - 我正在开发一个 Electron 应用程序,我确实需要找到一种方法(使用 JavaScript)来检测用户何时在最小化时从任务栏再次打开应用程序。感谢任何形式的帮助!

const remote = require('electron').remote;
document.getElementById("minApp").addEventListener("click", function (e) {
document.getElementById('minApp').style.opacity = '0.55';
document.getElementById('minApp').onmouseover = function() {
document.getElementById('minApp').style.opacity = '0.55';
}
document.getElementById('minApp').onmouseout = function() {
document.getElementById('minApp').style.opacity = '0.55';
}
var window = remote.getCurrentWindow();
window.minimize();
});
document.getElementById("closeApp").addEventListener("click", function (e) {
var window = remote.getCurrentWindow();
window.close();
});
var window = remote.getCurrentWindow();
window.on('restore', () => {
document.getElementById('minApp').style.opacity = '0.55';
document.getElementById('minApp').onmouseover = function() {
document.getElementById('minApp').style.opacity = '1';
}
document.getElementById('minApp').onmouseout = function() {
document.getElementById('minApp').style.opacity = '0.55';
}
alert(1);
})

最佳答案

尝试restore BrowserWindow 对象的事件。

Emitted when the window is restored from a minimized state.

mainWindow.on('restore', () => {
console.log('Restoring window from minimization');
})

关于javascript - Electron/浏览器 : Detect when the app is opened again from taskbar (after being minimized),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61198127/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com