Use the same V8 engine
instance
• Both Chromium and Node use the V8 engine
instance (Node use’s Chromium’s instance)
• The objects of Node and Chromium are in separate
contexts, in order to keep the namespace clean.
Main loop integration
• The author says that it would take “some efforts” to
merge both Node and Chromium’s main loops.
• Node uses libuv for the events loop, but Chromium
uses MessageLoop and MessagePump for its events
loop.
• The author integrates these at the browser render
process level, by making Chromium use a custom
version of the MessagePump class, built on top of
libuv
Context Bridging
• It’s a tricky but important part of integrating Node
into Chromium
• The first step is to initialise Node’s context first
• Next, once Webkit’s DOM context is installed, Node’s
context is moved into Webkit’s context
• After that, Node’s start function is split into parts so
that it can run within the context of Webkit’s render
process
For more information
• See this link:
• https://github.com/rogerwang/node-webkit/wiki/
How-node.js-is-integrated-with-chromium
You can use not only Node’s
core modules, but also npm
installed modules too!
And we could iterate on this
example further…
• We could turn the list items into links for exploring folders
• We could use front-end libraries like jQuery-ui or
Bootstrap to improve the UI and make it display better
• We could make the file names (and possibly even contents)
searchable using Lunr.js or an embedded database.
• We could stream those files to a server for file
synchronisation (build your own Dropbox!)
Window Rendering
• Node Webkit allows you to control how you want
the Window rendering to work
• You can specify set dimensions, whether full-
screen is allowed, and even if there’s a window
frame at all!
Kiosk Mode
• Useful for creating fullscreen applications that run in
public places (Banks, Retail, Venues)
• Access to the operating system is disabled on Mac,
but you can gain access on Windows via Ctrl-Alt-Del
keys (otherwise it’s blocked by AV Software as it looks
like a virus to them)
• Its dangerous - if you don’t implement the javascript
call to leave kiosk mode anywhere in your app, you’ll
have to reboot your computer to regain access
Disadvantages
• To use it, the person would have to have Flash
installed on their computer
• Once they had installed the app onto the computer,
they would then be prompted to locate the
application’s content on the USB stick.
• Adobe Air is a declining platform (Linux no longer
supported, Flash is dying)
Last year, we decided to
consider using Node Webkit
to replace the Adobe Air app
A couple of weeks after the
event, we shipped the desktop
app, using Node Webkit
The app’s tech stack
• Node Webkit, with ffmpeg dependency added in for video
• Bootstrap 3 for the UI
• jQuery and Backbone for the front-end app
• Lunr.js for the search functionality
• Stylus, and Jade for creating the HTML and CSS files
• Hogan.js for templating
• Gulp for the building of the app’s files
Benefits
• Users no longer had to install Flash or select the
USB from a Folder Dialog. A simpler, better user
experience.
• We were able to reuse some of the code from the
web application in the desktop application.
• It allowed us to standardise around a Node tech
stack within the company more.