【发布时间】:2020-07-26 14:47:36
【问题描述】:
我正在努力寻找解决我的问题的方法 - 我正在开发一个 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);
})
【问题讨论】:
标签: javascript browser electron minimize