Node-Webkit Tray on click bring window to front

大憨熊 提交于 2019-12-11 12:13:55

问题


I'm new to node-webkit and have the tray created as such

var gui = require('nw.gui');
var tray = new gui.Tray({ icon: 'images/Appicon.png' });
tray.on('click', function() { console.log("what goes in here?")});

When the tray icon is clicked I want the window to be pulled up if it's minimized and open index.html. Right now I get the log statement to print.


回答1:


Try this

var gui = require('nw.gui');
var win = gui.Window.get(); 

var tray = new gui.Tray({ 
    icon: 'images/Appicon.png' 
});
tray.on('click', function() { 
    win.maximize();
});


来源:https://stackoverflow.com/questions/26132365/node-webkit-tray-on-click-bring-window-to-front

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!