Skip to content

Latest commit

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

node-webkit-window-manager

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.

Example

Instantiate the window manager and store as a global reference.

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

Open the login page and pass a user object

varloginWindow=global.windowManager.open('login',{username: 'johndoe',auth_token: 'abc123',location: 'Earth'});

On login.html, get reference to user object

varloginWindow=global.windowManager.get('login');console.log('username is '+loginWindow.data.username);console.log('and is located on '+loginWindow.data.location);

Close the login window

global.windowManager.get('login').close();

Close all opened windows, except the background page.

global.windowManager.openWindows.forEach(function(windowRef){windowRef.close();});

About

A window manager for node-webkit

Resources

Stars

19 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages