Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • NW.js Essentials
  • Toc
  • feedback
NW.js Essentials

NW.js Essentials

By : Benoit
4.8 (5)
close
NW.js Essentials

NW.js Essentials

4.8 (5)
By: Benoit

Overview of this book

If you are an experienced Node.js developer who wants to create amazing desktop applications using NW.js, this is the book for you. Prior knowledge of HTML5, jQuery, and CSS is assumed.
Table of Contents (11 chapters)
close
10
Index

The Screen API – screen geometry functions

The Screen API has been lately added in order to better handle window sizing and positioning on single or multiple screens. Run the following code:

var gui = require('nw.gui');
gui.Screen.Init(); // Screen API is a Singleton
var screens = gui.Screen.screens;

You'll get an array of screen objects. Each screen object has the following structure:

screen {
  // unique id for a screen
  id : 69673536,

  // physical screen resolution
  bounds : {
    x : 0,
    y : 0,
    width : 1280,
    height : 800
  },

  // useable area within the screen bound
  work_area : {
    x : 0,
    y : 23,
    width : 1280,
    height : 773
  },
  scaleFactor : 1,
  isBuiltIn : false
}

You can easily access any of these properties in order to improve the user experience. Let's say, for example, that you want to position your window in the top-right corner of the screen. On Microsoft Windows, you would probably proceed as follows:

var gui = require...
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete