NWJS
CROSS PLATFORM DESKTOP APPLICATION DEVELOPMENT
Aigars Zeiza
• Working in “Accenture” as front end developer
• >5yrs of experience
• Author of “Zinc” navigation system
HTML5 on desktop
Why you should choose an HTML5 for desktop?
• To create difficult UI faster
• To migrate an existing web app to desktop
• You are a frontend developer
NW.js (node-webkit)
“NW.JS (PREVIOUSLY KNOWN AS NODE-WEBKIT) LETS YOU CALL ALL NODE.JS MODULES
DIRECTLY FROM DOM AND ENABLES A NEW WAY OF WRITING APPLICATIONS WITH ALL
WEB TECHNOLOGIES.”
NWJS.IO
NWJS is cross-platform
NWJS vs Electron
NWJS Electron
Browser runtime Chromium libchromiumcontent
Chromium version 62.0.3202.75 59.0.3071.115
Nodejs version 8.8.1 8.2.1
V8 version 6.1.534.42 5.9.211.38
Entry Point HTML or JS JS only
Bare Distribution Size 139MB (52MB zipped) 125MB (45MB zipped)
Chrome Apps Support Yes No
Support of chrome.* APIs Yes No
Source Code Protection V8 Snapshot ASAR Archive Support
Crash reporting No Yes
Stars on github 32k 52k
Setup our dev environment
• Any code editor (Vscode, Sublime text, Atom, Webstorm…)
• Nodejs > 4.x
• (recommend) Npm install –g nwjs
• (recommend) Npm install nwjs-builder-phoenix
Prepare our first app
Prepare our first app
OR
Setup of NWjs
OFFICIAL DOCS:
• Download nwjs distributive
• Use command like:
/path/to/your/app
/path/to/nw .
Setup of NWjs
OFFICIAL DOCS:
• Download nwjs distributive
• Use command like:
MORE OPTIMAL SOLUTION:
• Use “nwjs” npm package
• Use same scripts for all developer team
members
/path/to/your/app
/path/to/nw .
Distribute
Use of build-nwjs-phoenix
SOURCE CODE BUILT APPLICATION
Native UI API
What we can do with nw.gui
• Use file dialogs – “select folder” and “save as”
• Use windows tray
• Shell – collection of APIs that do desktop related jobs
• Handling files and arguments
• Frameless, transparent window
Native modules
USING OF THIRD PARTY NATIVE MODULES
Using of third party native modules requires
• Python 2.x
• Visual C++
Testing
NWJS uses Mocha to run tests
Run tests in child process with nw_test_app module
MOCHA_TEST.JS APP
Development features
• Chromium developer tools
• Easy to implement of Hot Reload
Development features
• Chromium developer tools
• Easy to implement of Hot Reload
Basic solution
Development features
• Chromium developer tools
• Easy to implement of Hot Reload
Gulp
More advanced solution with Gulp
Questions?

NWJS. Web on desktop