This is a utility to help manage all windows in a node-webkit application. It gives all open windows a global reference to other windows and allows passing data between windows.
varWindowManager=require('node-webkit-window-manager').windowManager;vargui=require('nw.gui');global.windowManager=newWindowManager(gui,{"login": {// the name "key" of the windowpage: "html/login.html",// the path to the HTML page.options: {// Standard nw.gui Window optionsframe : true,toolbar: true,width: 500,height: 600,show: true}},"dashboard": {page:"html/dashboard.html",options: {frame : true,toolbar: true,width: 900,height: 700,show: true}},"index": {page:"html/index.html",options: {frame: true,toolbar: true,width: 900,height: 700,show: true}}});varloginWindow=global.windowManager.open('login',{username: 'johndoe',auth_token: 'abc123',location: 'Earth'});varloginWindow=global.windowManager.get('login');console.log('username is '+loginWindow.data.username);console.log('and is located on '+loginWindow.data.location);global.windowManager.get('login').close();global.windowManager.openWindows.forEach(function(windowRef){windowRef.close();});