电子/浏览器:检测何时从任务栏再次打开应用程序(在最小化之后)

问题描述 投票:0回答:1

我正在努力找到解决问题的方法-我正在开发一个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
1个回答
0
投票

restore对象尝试restore事件。

从最小化状态还原窗口时发出。

BrowserWindow
© www.soinside.com 2019 - 2024. All rights reserved.