Features and drawbacks of NW.js
Let's check some of the features that characterize NW.js:
- NW.js allows us to realize modern desktop applications using HTML5, CSS3, JS, WebGL, and the full potential of Node.js, including the use of third-party modules
- The Native UI API allows you to implement native lookalike applications with the support of menus, clipboards, tray icons, and file binding
- Since Node.js and WebKit run within the same thread, NW.js has excellent performance
- With NW.js, it is incredibly easy to port existing web applications to desktop applications
- Thanks to the CLI and the presence of third-party tools, it's really easy to debug, package, and deploy applications on Microsoft Windows, Mac OS, and Linux
However, all that glitters is not gold. There are some cons to consider when developing an application with NW.js:
- Size of the application: Since a copy of NW.js (70-90 MB) must be distributed along with each application, the size of the application makes it quite expensive compared to native applications. Anyway, if you're concerned about download times, compressing NW.js for distribution will save you about half the size.
- Difficulties in distributing your application through Mac App Store: In this book, it will not be discussed (just do a search on Google), but even if the procedure is rather complex, you can distribute your NW.js application through Mac App Store. At the moment, it is not possible to deploy a NW.js application on Windows Store due to the different architecture of
.appx
applications. - Missing support for iOS or Android: Unlike other SDKs and libraries, at the moment, it is not possible to deploy an NW.js application on iOS or Android, and it does not seem to be possible to do so in the near future. However, the portability of the HTML, JavaScript, and CSS code that can be distributed on other platforms with tools such as PhoneGap or TideSDK should be considered. Unfortunately, this is not true for all of the features implemented using Node.js.
- Stability: Finally, the platform is still quite young and not bug-free.
NW.js – usage scenarios
The flexibility and good performance of NW.js allows its use in countless scenarios, but, for convenience, I'm going to report only a few notable ones:
- Development tools
- Implementation of the GUI around existing CLI tools
- Multimedia applications
- Web services clients
- Video games
The choice of development platform for a new project clearly depends only on the developer; for the overall aim of confronting facts, it may be useful to consider some specific scenarios where the use of NW.js might not be recommended:
- When developing for a specific platform, graphic coherence is essential, and, perhaps, it is necessary to distribute the application through a store
- If the performance factor limits the use of the preceding technologies
- If the application does a massive use of the features provided by the application layer via Node.js and it has to be distributed to mobile devices
Popular NW.js applications
After summarizing the pros and cons of NW.js, let's not forget the real strength of the platform—the many applications built on top of NW.js that have already been distributed. We list a few that are worth noting:
- Wunderlist for Windows 7: This is a to-do list / schedule management app used by millions
- Cellist: This is an HTTP debugging proxy available on Mac App Store
- Game Dev Tycoon: This is one of the first NW.js games that puts you in the shoes of a 1980s game developer
- Intel® XDK: This is an HTML5 cross-platform solution that enables developers to write web and hybrid apps