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

Using NW.js' main module


As we stated in the first chapter, NW.js checks for the main field in the manifest file in order to load the given file when opening the application's first window. The node-main field acts similarly, but instead of referring to an HTML file, it will allow you to set a main Node.js module, which will run in the background through the application's life cycle independently of the window context (even though it will quit by default when all the application windows are closed).

In the previous chapter, we've seen that we can use process.mainModule from the window context in order to get the main module, but more specifically, besides global, we can take advantage of process.mainModule.exports to share objects between the two contexts.

Tip

Thanks to the global object, the window object is also shared with the main module, but you can't obviously access it until a ready signal is sent from the DOM.

Let's see an example:

  • package.json:

    {
      "name": "secondsSinceStart",
      "node...
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