单击"Node-Webkit托盘"将窗口移到最前面 [英] Node-Webkit Tray on click bring window to front

查看:146
本文介绍了单击"Node-Webkit托盘"将窗口移到最前面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是node-webkit的新手,因此创建了任务栏

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?")});

单击托盘图标时,如果窗口最小化,我希望将其拉起并打开index.html. 现在,我得到要打印的日志语句.

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.

推荐答案

尝试一下

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();
});

这篇关于单击"Node-Webkit托盘"将窗口移到最前面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆