// Load native UI libraryvar gui = require('nw.gui');
对于 App
含有argv(array),dataPath,fullArgv(array),mainfest(object);
对于argv:
对于dataPath:描述这个项目的地址(本地项目)
对于fullArgv:
对于mainfest:主要是package.json中配置的详细信息。
对于Base
对于Clipboard
作用:剪切板
对于Menu
用法:
var menu = new Menu();
详情:
含有方法:
1.append(menu_item);2.insert(memu_item,i);3.popup(x,y);4.remove(men_item);5.removeAt(i);
对于MenuItem
用法:
var menuItem = new gui.MenuItem({label:"test"});
详情:
// 创建一个 menu对象 var trayMenu = new gui.Menu(); //创建多个 menuItem对象 trayMenu.append(new gui.MenuItem({label: "test1"})); trayMenu.append(new gui.MenuItem({label: "test2"})); // handleEvent(ev); trayMenu.append(new gui.MenuItem({label: "test3",click:function(){ console.log("test3 click"); }));
对于Screen
对于Shell
// methodopenExternal(uri); 在系统浏览器中打开链接openItem(path); 使用默认文件编辑器打开文件showItemInFolder(path); 在文件管理器中显示文件。
对于Shortcut
对于Tray
用法:
var tray = new gui.Tray();tray.title = "Tray";tray.icon = "icon.png";tray.menu = Menu;
详情:
对于Window
用法:
var win = gui.Window.get()var new_win = gui.Window.open("http://example.com");
含有两个方法: get(other),open(url,options)
对于方法get(other):获取到window对象。
对于方法open(url,options): 用于打开一个新的窗口,参数url:窗口url, options:参数。