SlideShare a Scribd company logo
1 of 27
JAVASCRIPT ON   Building desktop apps in

 THE DESKTOP    HTML5 and JavaScript



                      @DOMENIC
DOMENIC
DENICOLA

• https://github.com/domenic
• https://npmjs.org/~domenic
• http://slideshare.net/domenicdenicola


Things I’ve done recently:
• http://es6isnigh.com
• Promises/A+
• Real-World Windows 8 Apps in JS



                                          @DOMENIC
WHY DESKTOP APPS?
Two reasons:




                     @DOMENIC
WHY DESKTOP APPS?




                    @DOMENIC
WHY DESKTOP APPS?




                    @DOMENIC
WHY DESKTOP APPS?




                    @DOMENIC
WHY DESKTOP APPS?




                    @DOMENIC
IN THE WILD




              @DOMENIC
IN THE WILD




              @DOMENIC
HOW?




http://www.chromium.org/developers/content-
module                                        @DOMENIC
THE CHROME CONTENT
API




                @DOMENIC
CHROMIUM EMBEDDED
FRAMEWORK




http://code.google.com/p/chromiumembedded/
                                             @DOMENIC
CHROMIUM EMBEDDED
 FRAMEWORK
• Windows, Mac OS X, Linux
• Create objects in C++, expose them through JS
• Integrate NPAPI plugins
• Intercept HTTP requests, including custom schemes
• Completely customizable browser settings, restrictions, and
  flags
• … and it’s C++, so do whatever you want!




                                                         @DOMENIC
CHROMIUM EMBEDDED
 FRAMEWORK
// Create an instance of our CefClient implementation. Various
// methods in the MyClient instance will be called to notify
// about and customize browser behavior.
CefRefPtr<CefClient> client(new MyClient());

// Information about the parent window, client rectangle, etc.
CefWindowInfo info;
info.SetAsChild(...);

// Browser initialization settings.
CefBrowserSettings settings;

// Create the new browser window object.
CefBrowser::CreateBrowser(info, client, "http://www.google.com",
                          settings);
                                                   @DOMENIC
BUT I DON’T LIKE C++…




          TO THE RESCUE

                   @DOMENIC
TWO PROJECTS, BOTH
ALIKE IN DIGNITY
AppJS     Node-WebKit




                        @DOMENIC
APPJS
var appjs = require('appjs');
appjs.serveFilesFrom(__dirname + '/content');
appjs.router.post('/', function (req, res, next) {
  res.send('Hello, World!');
});
var window = appjs.createWindow({
  url: '/',
  width: 640,
  height: 480,
  fullscreen: false,
  showChrome: true, // border and title bar
  disableSecurity: true // allow cross-origin requests
});


                                                         @DOMENIC
APPJS: CONTROL NODE
 FROM YOUR APP
window.on('ready', function () {
  window.frame.show();
  window.require = require;
  window.process = process;
  window.module = module;
});




                                   @DOMENIC
APPJS: CONTROL YOUR
 APP FROM NODE
window.on('close', ...);
window.on('resize', ...);
window.on('minimize', ...);
window.on('fullscreen', ...);

window.frame.show();
window.frame.hide();
window.frame.fullscreen();
window.frame.openDevTools();

window.dispatchEvent(new window.Event('custom'));




                                                    @DOMENIC
APPJS: MENU BARS
var menu = appjs.createMenu([{
  label: '&File',
  submenu: [
    {
      label: 'E&xit',
      action: function () {
        window.close();
      }
    }
  ]
}]);

window.frame.setMenuBar(menu);


                                 @DOMENIC
APPJS: MORE COOL
 STUFF
• Add tray icons and tray menus
• Add a require that works for modules on both the Node side
  and the browser side
• Redirect Node’s stdout/stderr to the Chromium dev console
• Use Express to handle routes, render views, etc.
• Use any third-party Node package to do anything!




                                                       @DOMENIC
NODE-WEBKIT
<html>
 <head>
  <title>Hello World!</title>
 </head>
 <body>
  <h1>Hello World!</h1>
  <p>We are using node.js
    <script>document.write(process.version);</script>
  </p>
 </body>
</html>




                                                        @DOMENIC
NODE-WEBKIT: A
 TECHNICAL MARVEL
• Not built on CEF; they did the work themselves
• Merged Node and Chromium’s event loops by implementing
  Chromium’s in terms of libuv
  • For example: modal dialogs like alert() block Node’s event loop

• Node objects and DOM objects reside in the same V8 heap:
  no inter-process communication, serialization, or thread
  issues. Direct access!
• Apps can have multiple windows; distinct window
  variables, but shared global variable.
• Great plugin integration: just drop NPAPI plugins into a plugins
  folder.
• Package apps by concatenating them with the nw executable
  (!)                                                @DOMENIC
NODE-WEBKIT:
    PACKAGE.JSON
{
    "name": "nw-demo",
    "main": "index.html",
    "node-main": "start.js",
    "window": {
      "title": "Node-WebKit Demo",
      "icon": "demo.ico",
      "width": 640,
      "height": 480,
      "toolbar": false,
      "fullscreen": false
    }
}


                                     @DOMENIC
NODE-WEBKIT:
 PLATFORM
 INTEGRATION
window.minimize();
window.enterFullscreen();
window.showDevTools();
window.requestAttention(true);
var gui = require('nw.gui');
var menu = new gui.Menu();
menu.append(new gui.MenuItem({
  label: 'Item A',
  icon: 'images/a.png',
  click: function () { }
}));
window.addEventListener('contextmenu', function (event) {
  menu.popup(event.clientX, event.clientY);
});

                                                        @DOMENIC
NODE-WEBKIT:
 PLATFORM
 INTEGRATION
var gui = require('nw.gui');

var clipboard = gui.Clipboard.get();
clipboard.get('text');
clipboard.set('I <3 Node-WebKit', 'text');
clipboard.clear();


<input type="file" />
<input type="file" multiple />
<input type="file" nwdirectory />
<input type="file" nwsaveas />

$('input[type=file]').click();

                                             @DOMENIC
DEMO TIME




            @DOMENIC

More Related Content

What's hot

Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...Domenic Denicola
 
The Beauty Of Java Script V5a
The Beauty Of Java Script V5aThe Beauty Of Java Script V5a
The Beauty Of Java Script V5arajivmordani
 
Building a real life application in node js
Building a real life application in node jsBuilding a real life application in node js
Building a real life application in node jsfakedarren
 
Vue.js + Django - configuración para desarrollo con webpack y HMR
Vue.js + Django - configuración para desarrollo con webpack y HMRVue.js + Django - configuración para desarrollo con webpack y HMR
Vue.js + Django - configuración para desarrollo con webpack y HMRJavier Abadía
 
Introduction to Nodejs
Introduction to NodejsIntroduction to Nodejs
Introduction to NodejsGabriele Lana
 
Boom! Promises/A+ Was Born
Boom! Promises/A+ Was BornBoom! Promises/A+ Was Born
Boom! Promises/A+ Was BornDomenic Denicola
 
Asynchronous PHP and Real-time Messaging
Asynchronous PHP and Real-time MessagingAsynchronous PHP and Real-time Messaging
Asynchronous PHP and Real-time MessagingSteve Rhoades
 
Groovy Ecosystem - JFokus 2011 - Guillaume Laforge
Groovy Ecosystem - JFokus 2011 - Guillaume LaforgeGroovy Ecosystem - JFokus 2011 - Guillaume Laforge
Groovy Ecosystem - JFokus 2011 - Guillaume LaforgeGuillaume Laforge
 
Javascript is your (Auto)mate
Javascript is your (Auto)mateJavascript is your (Auto)mate
Javascript is your (Auto)mateCodemotion
 
Node.js in action
Node.js in actionNode.js in action
Node.js in actionSimon Su
 
The promise of asynchronous PHP
The promise of asynchronous PHPThe promise of asynchronous PHP
The promise of asynchronous PHPWim Godden
 
Websockets talk at Rubyconf Uruguay 2010
Websockets talk at Rubyconf Uruguay 2010Websockets talk at Rubyconf Uruguay 2010
Websockets talk at Rubyconf Uruguay 2010Ismael Celis
 
Asynchronous programming patterns in Perl
Asynchronous programming patterns in PerlAsynchronous programming patterns in Perl
Asynchronous programming patterns in Perldeepfountainconsulting
 
Server Side JavaScript - You ain't seen nothing yet
Server Side JavaScript - You ain't seen nothing yetServer Side JavaScript - You ain't seen nothing yet
Server Side JavaScript - You ain't seen nothing yetTom Croucher
 
Unity and WebSockets
Unity and WebSocketsUnity and WebSockets
Unity and WebSocketsJosh Glover
 

What's hot (20)

Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
 
The Beauty Of Java Script V5a
The Beauty Of Java Script V5aThe Beauty Of Java Script V5a
The Beauty Of Java Script V5a
 
The Beauty of Java Script
The Beauty of Java ScriptThe Beauty of Java Script
The Beauty of Java Script
 
Building a real life application in node js
Building a real life application in node jsBuilding a real life application in node js
Building a real life application in node js
 
Vue.js + Django - configuración para desarrollo con webpack y HMR
Vue.js + Django - configuración para desarrollo con webpack y HMRVue.js + Django - configuración para desarrollo con webpack y HMR
Vue.js + Django - configuración para desarrollo con webpack y HMR
 
Promises, Promises
Promises, PromisesPromises, Promises
Promises, Promises
 
Introduction to Nodejs
Introduction to NodejsIntroduction to Nodejs
Introduction to Nodejs
 
Boom! Promises/A+ Was Born
Boom! Promises/A+ Was BornBoom! Promises/A+ Was Born
Boom! Promises/A+ Was Born
 
New Design of OneRing
New Design of OneRingNew Design of OneRing
New Design of OneRing
 
Node.js - Best practices
Node.js  - Best practicesNode.js  - Best practices
Node.js - Best practices
 
Asynchronous PHP and Real-time Messaging
Asynchronous PHP and Real-time MessagingAsynchronous PHP and Real-time Messaging
Asynchronous PHP and Real-time Messaging
 
Groovy Ecosystem - JFokus 2011 - Guillaume Laforge
Groovy Ecosystem - JFokus 2011 - Guillaume LaforgeGroovy Ecosystem - JFokus 2011 - Guillaume Laforge
Groovy Ecosystem - JFokus 2011 - Guillaume Laforge
 
Javascript is your (Auto)mate
Javascript is your (Auto)mateJavascript is your (Auto)mate
Javascript is your (Auto)mate
 
Advanced JavaScript
Advanced JavaScriptAdvanced JavaScript
Advanced JavaScript
 
Node.js in action
Node.js in actionNode.js in action
Node.js in action
 
The promise of asynchronous PHP
The promise of asynchronous PHPThe promise of asynchronous PHP
The promise of asynchronous PHP
 
Websockets talk at Rubyconf Uruguay 2010
Websockets talk at Rubyconf Uruguay 2010Websockets talk at Rubyconf Uruguay 2010
Websockets talk at Rubyconf Uruguay 2010
 
Asynchronous programming patterns in Perl
Asynchronous programming patterns in PerlAsynchronous programming patterns in Perl
Asynchronous programming patterns in Perl
 
Server Side JavaScript - You ain't seen nothing yet
Server Side JavaScript - You ain't seen nothing yetServer Side JavaScript - You ain't seen nothing yet
Server Side JavaScript - You ain't seen nothing yet
 
Unity and WebSockets
Unity and WebSocketsUnity and WebSockets
Unity and WebSockets
 

Viewers also liked

How to Win Friends and Influence Standards Bodies
How to Win Friends and Influence Standards BodiesHow to Win Friends and Influence Standards Bodies
How to Win Friends and Influence Standards BodiesDomenic Denicola
 
Real World Windows 8 Apps in JavaScript
Real World Windows 8 Apps in JavaScriptReal World Windows 8 Apps in JavaScript
Real World Windows 8 Apps in JavaScriptDomenic Denicola
 
Creating Truly RESTful APIs
Creating Truly RESTful APIsCreating Truly RESTful APIs
Creating Truly RESTful APIsDomenic Denicola
 
Establecimientos comerciales de la manzana 3
Establecimientos comerciales de la manzana 3Establecimientos comerciales de la manzana 3
Establecimientos comerciales de la manzana 3Cristian Sanchez
 
Estrategia de Desarrollo Local Participativo-AGUJAMA
Estrategia de Desarrollo Local Participativo-AGUJAMAEstrategia de Desarrollo Local Participativo-AGUJAMA
Estrategia de Desarrollo Local Participativo-AGUJAMAAnabella Agujama
 
Safe Creative qué hacemos y cómo lo hacemos
Safe Creative qué hacemos y cómo lo hacemosSafe Creative qué hacemos y cómo lo hacemos
Safe Creative qué hacemos y cómo lo hacemosSafe Creative
 
JavaScript - new features in ECMAScript 6
JavaScript - new features in ECMAScript 6JavaScript - new features in ECMAScript 6
JavaScript - new features in ECMAScript 6Solution4Future
 
e-Marke Checkliste für Wohnungen
e-Marke Checkliste für Wohnungene-Marke Checkliste für Wohnungen
e-Marke Checkliste für Wohnungene-Marke Österreich
 
ES6 - Next Generation Javascript
ES6 - Next Generation JavascriptES6 - Next Generation Javascript
ES6 - Next Generation JavascriptRamesh Nair
 
An Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnitAn Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnitweili_at_slideshare
 
ES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern JavascriptES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern JavascriptWojciech Dzikowski
 
The New JavaScript: ES6
The New JavaScript: ES6The New JavaScript: ES6
The New JavaScript: ES6Rob Eisenberg
 
ES2015 (ES6) Overview
ES2015 (ES6) OverviewES2015 (ES6) Overview
ES2015 (ES6) Overviewhesher
 
Folio tahun 5 penjajahan dan tokoh
Folio tahun 5 penjajahan dan tokohFolio tahun 5 penjajahan dan tokoh
Folio tahun 5 penjajahan dan tokohGinny Gouri
 

Viewers also liked (20)

How to Win Friends and Influence Standards Bodies
How to Win Friends and Influence Standards BodiesHow to Win Friends and Influence Standards Bodies
How to Win Friends and Influence Standards Bodies
 
Real World Windows 8 Apps in JavaScript
Real World Windows 8 Apps in JavaScriptReal World Windows 8 Apps in JavaScript
Real World Windows 8 Apps in JavaScript
 
Creating Truly RESTful APIs
Creating Truly RESTful APIsCreating Truly RESTful APIs
Creating Truly RESTful APIs
 
The Final Frontier
The Final FrontierThe Final Frontier
The Final Frontier
 
Client-Side Packages
Client-Side PackagesClient-Side Packages
Client-Side Packages
 
Establecimientos comerciales de la manzana 3
Establecimientos comerciales de la manzana 3Establecimientos comerciales de la manzana 3
Establecimientos comerciales de la manzana 3
 
Estrategia de Desarrollo Local Participativo-AGUJAMA
Estrategia de Desarrollo Local Participativo-AGUJAMAEstrategia de Desarrollo Local Participativo-AGUJAMA
Estrategia de Desarrollo Local Participativo-AGUJAMA
 
Safe Creative qué hacemos y cómo lo hacemos
Safe Creative qué hacemos y cómo lo hacemosSafe Creative qué hacemos y cómo lo hacemos
Safe Creative qué hacemos y cómo lo hacemos
 
JavaScript - new features in ECMAScript 6
JavaScript - new features in ECMAScript 6JavaScript - new features in ECMAScript 6
JavaScript - new features in ECMAScript 6
 
e-Marke Checkliste für Wohnungen
e-Marke Checkliste für Wohnungene-Marke Checkliste für Wohnungen
e-Marke Checkliste für Wohnungen
 
Async Frontiers
Async FrontiersAsync Frontiers
Async Frontiers
 
ES6 - Next Generation Javascript
ES6 - Next Generation JavascriptES6 - Next Generation Javascript
ES6 - Next Generation Javascript
 
Domains!
Domains!Domains!
Domains!
 
Oribi deck
Oribi deckOribi deck
Oribi deck
 
An Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnitAn Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnit
 
ES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern JavascriptES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern Javascript
 
The New JavaScript: ES6
The New JavaScript: ES6The New JavaScript: ES6
The New JavaScript: ES6
 
ES2015 (ES6) Overview
ES2015 (ES6) OverviewES2015 (ES6) Overview
ES2015 (ES6) Overview
 
ES6: The Awesome Parts
ES6: The Awesome PartsES6: The Awesome Parts
ES6: The Awesome Parts
 
Folio tahun 5 penjajahan dan tokoh
Folio tahun 5 penjajahan dan tokohFolio tahun 5 penjajahan dan tokoh
Folio tahun 5 penjajahan dan tokoh
 

Similar to JavaScript on the Desktop

Electron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easyElectron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easyUlrich Krause
 
Desktop apps with node webkit
Desktop apps with node webkitDesktop apps with node webkit
Desktop apps with node webkitPaul Jensen
 
Puppeteer can automate that! - Frontmania
Puppeteer can automate that! - FrontmaniaPuppeteer can automate that! - Frontmania
Puppeteer can automate that! - FrontmaniaÖnder Ceylan
 
What Web Developers Need to Know to Develop Windows 8 Apps
What Web Developers Need to Know to Develop Windows 8 AppsWhat Web Developers Need to Know to Develop Windows 8 Apps
What Web Developers Need to Know to Develop Windows 8 AppsDoris Chen
 
Intro To webOS
Intro To webOSIntro To webOS
Intro To webOSfpatton
 
Intro to jQuery @ Startup Institute
Intro to jQuery @ Startup InstituteIntro to jQuery @ Startup Institute
Intro to jQuery @ Startup InstituteRafael Gonzaque
 
Web APIs & Apps - Mozilla
Web APIs & Apps - MozillaWeb APIs & Apps - Mozilla
Web APIs & Apps - MozillaRobert Nyman
 
Introduction to Palm's Mojo SDK
Introduction to Palm's Mojo SDKIntroduction to Palm's Mojo SDK
Introduction to Palm's Mojo SDKBrendan Lim
 
Native client
Native clientNative client
Native clientzyc901016
 
HTML5 on Mobile
HTML5 on MobileHTML5 on Mobile
HTML5 on MobileAdam Lu
 
Web versus Native: round 1!
Web versus Native: round 1!Web versus Native: round 1!
Web versus Native: round 1!Chris Mills
 
Disrupting the application eco system with progressive web applications
Disrupting the application eco system with progressive web applicationsDisrupting the application eco system with progressive web applications
Disrupting the application eco system with progressive web applicationsChris Love
 
Parse cloud code
Parse cloud codeParse cloud code
Parse cloud code維佋 唐
 
NativeScript and Angular
NativeScript and AngularNativeScript and Angular
NativeScript and AngularJen Looper
 
HTML5 for Rich User Experience
HTML5 for Rich User ExperienceHTML5 for Rich User Experience
HTML5 for Rich User ExperienceMahbubur Rahman
 

Similar to JavaScript on the Desktop (20)

Electron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easyElectron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easy
 
Desktop apps with node webkit
Desktop apps with node webkitDesktop apps with node webkit
Desktop apps with node webkit
 
Sanjeev ghai 12
Sanjeev ghai 12Sanjeev ghai 12
Sanjeev ghai 12
 
Puppeteer can automate that! - Frontmania
Puppeteer can automate that! - FrontmaniaPuppeteer can automate that! - Frontmania
Puppeteer can automate that! - Frontmania
 
What Web Developers Need to Know to Develop Windows 8 Apps
What Web Developers Need to Know to Develop Windows 8 AppsWhat Web Developers Need to Know to Develop Windows 8 Apps
What Web Developers Need to Know to Develop Windows 8 Apps
 
Intro To webOS
Intro To webOSIntro To webOS
Intro To webOS
 
Txjs
TxjsTxjs
Txjs
 
Node azure
Node azureNode azure
Node azure
 
Intro to jQuery @ Startup Institute
Intro to jQuery @ Startup InstituteIntro to jQuery @ Startup Institute
Intro to jQuery @ Startup Institute
 
Always on! Or not?
Always on! Or not?Always on! Or not?
Always on! Or not?
 
Web APIs & Apps - Mozilla
Web APIs & Apps - MozillaWeb APIs & Apps - Mozilla
Web APIs & Apps - Mozilla
 
Introduction to Palm's Mojo SDK
Introduction to Palm's Mojo SDKIntroduction to Palm's Mojo SDK
Introduction to Palm's Mojo SDK
 
Mobile native-hacks
Mobile native-hacksMobile native-hacks
Mobile native-hacks
 
Native client
Native clientNative client
Native client
 
HTML5 on Mobile
HTML5 on MobileHTML5 on Mobile
HTML5 on Mobile
 
Web versus Native: round 1!
Web versus Native: round 1!Web versus Native: round 1!
Web versus Native: round 1!
 
Disrupting the application eco system with progressive web applications
Disrupting the application eco system with progressive web applicationsDisrupting the application eco system with progressive web applications
Disrupting the application eco system with progressive web applications
 
Parse cloud code
Parse cloud codeParse cloud code
Parse cloud code
 
NativeScript and Angular
NativeScript and AngularNativeScript and Angular
NativeScript and Angular
 
HTML5 for Rich User Experience
HTML5 for Rich User ExperienceHTML5 for Rich User Experience
HTML5 for Rich User Experience
 

More from Domenic Denicola

More from Domenic Denicola (7)

ES6 in Real Life
ES6 in Real LifeES6 in Real Life
ES6 in Real Life
 
Streams for the Web
Streams for the WebStreams for the Web
Streams for the Web
 
After Return of the Jedi
After Return of the JediAfter Return of the Jedi
After Return of the Jedi
 
The State of JavaScript
The State of JavaScriptThe State of JavaScript
The State of JavaScript
 
The Extensible Web
The Extensible WebThe Extensible Web
The Extensible Web
 
The Promised Land (in Angular)
The Promised Land (in Angular)The Promised Land (in Angular)
The Promised Land (in Angular)
 
Unit Testing for Great Justice
Unit Testing for Great JusticeUnit Testing for Great Justice
Unit Testing for Great Justice
 

Recently uploaded

Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 

Recently uploaded (20)

Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 

JavaScript on the Desktop

  • 1. JAVASCRIPT ON Building desktop apps in THE DESKTOP HTML5 and JavaScript @DOMENIC
  • 2. DOMENIC DENICOLA • https://github.com/domenic • https://npmjs.org/~domenic • http://slideshare.net/domenicdenicola Things I’ve done recently: • http://es6isnigh.com • Promises/A+ • Real-World Windows 8 Apps in JS @DOMENIC
  • 3. WHY DESKTOP APPS? Two reasons: @DOMENIC
  • 4. WHY DESKTOP APPS? @DOMENIC
  • 5. WHY DESKTOP APPS? @DOMENIC
  • 6. WHY DESKTOP APPS? @DOMENIC
  • 7. WHY DESKTOP APPS? @DOMENIC
  • 8. IN THE WILD @DOMENIC
  • 9. IN THE WILD @DOMENIC
  • 13. CHROMIUM EMBEDDED FRAMEWORK • Windows, Mac OS X, Linux • Create objects in C++, expose them through JS • Integrate NPAPI plugins • Intercept HTTP requests, including custom schemes • Completely customizable browser settings, restrictions, and flags • … and it’s C++, so do whatever you want! @DOMENIC
  • 14. CHROMIUM EMBEDDED FRAMEWORK // Create an instance of our CefClient implementation. Various // methods in the MyClient instance will be called to notify // about and customize browser behavior. CefRefPtr<CefClient> client(new MyClient()); // Information about the parent window, client rectangle, etc. CefWindowInfo info; info.SetAsChild(...); // Browser initialization settings. CefBrowserSettings settings; // Create the new browser window object. CefBrowser::CreateBrowser(info, client, "http://www.google.com", settings); @DOMENIC
  • 15. BUT I DON’T LIKE C++… TO THE RESCUE @DOMENIC
  • 16. TWO PROJECTS, BOTH ALIKE IN DIGNITY AppJS Node-WebKit @DOMENIC
  • 17. APPJS var appjs = require('appjs'); appjs.serveFilesFrom(__dirname + '/content'); appjs.router.post('/', function (req, res, next) { res.send('Hello, World!'); }); var window = appjs.createWindow({ url: '/', width: 640, height: 480, fullscreen: false, showChrome: true, // border and title bar disableSecurity: true // allow cross-origin requests }); @DOMENIC
  • 18. APPJS: CONTROL NODE FROM YOUR APP window.on('ready', function () { window.frame.show(); window.require = require; window.process = process; window.module = module; }); @DOMENIC
  • 19. APPJS: CONTROL YOUR APP FROM NODE window.on('close', ...); window.on('resize', ...); window.on('minimize', ...); window.on('fullscreen', ...); window.frame.show(); window.frame.hide(); window.frame.fullscreen(); window.frame.openDevTools(); window.dispatchEvent(new window.Event('custom')); @DOMENIC
  • 20. APPJS: MENU BARS var menu = appjs.createMenu([{ label: '&File', submenu: [ { label: 'E&xit', action: function () { window.close(); } } ] }]); window.frame.setMenuBar(menu); @DOMENIC
  • 21. APPJS: MORE COOL STUFF • Add tray icons and tray menus • Add a require that works for modules on both the Node side and the browser side • Redirect Node’s stdout/stderr to the Chromium dev console • Use Express to handle routes, render views, etc. • Use any third-party Node package to do anything! @DOMENIC
  • 22. NODE-WEBKIT <html> <head> <title>Hello World!</title> </head> <body> <h1>Hello World!</h1> <p>We are using node.js <script>document.write(process.version);</script> </p> </body> </html> @DOMENIC
  • 23. NODE-WEBKIT: A TECHNICAL MARVEL • Not built on CEF; they did the work themselves • Merged Node and Chromium’s event loops by implementing Chromium’s in terms of libuv • For example: modal dialogs like alert() block Node’s event loop • Node objects and DOM objects reside in the same V8 heap: no inter-process communication, serialization, or thread issues. Direct access! • Apps can have multiple windows; distinct window variables, but shared global variable. • Great plugin integration: just drop NPAPI plugins into a plugins folder. • Package apps by concatenating them with the nw executable (!) @DOMENIC
  • 24. NODE-WEBKIT: PACKAGE.JSON { "name": "nw-demo", "main": "index.html", "node-main": "start.js", "window": { "title": "Node-WebKit Demo", "icon": "demo.ico", "width": 640, "height": 480, "toolbar": false, "fullscreen": false } } @DOMENIC
  • 25. NODE-WEBKIT: PLATFORM INTEGRATION window.minimize(); window.enterFullscreen(); window.showDevTools(); window.requestAttention(true); var gui = require('nw.gui'); var menu = new gui.Menu(); menu.append(new gui.MenuItem({ label: 'Item A', icon: 'images/a.png', click: function () { } })); window.addEventListener('contextmenu', function (event) { menu.popup(event.clientX, event.clientY); }); @DOMENIC
  • 26. NODE-WEBKIT: PLATFORM INTEGRATION var gui = require('nw.gui'); var clipboard = gui.Clipboard.get(); clipboard.get('text'); clipboard.set('I <3 Node-WebKit', 'text'); clipboard.clear(); <input type="file" /> <input type="file" multiple /> <input type="file" nwdirectory /> <input type="file" nwsaveas /> $('input[type=file]').click(); @DOMENIC
  • 27. DEMO TIME @DOMENIC

Editor's Notes

  1. Hook: I started with C++, wrote desktop apps, moved to JS, etc.
  2. I work at Barnes &amp; Noble.com in the Digital Education division.We produce NOOK Study, an e-textbook reader designed to help students read and annotate their books, as a desktop app for Mac and PC
  3. Everyone still uses computers!
  4. Also: file system access, integration with native code, etc.
  5. Control over your environment
  6. The old problems with desktop apps are disappearing
  7. Chrome Content API: “content” not “Chrome” - Contains only the core code needed to render a page: HTML5, GPU accelerated compositing, etc. - Underlies Chrome’s multiprocess architecture: “chrome” talks to “content” over inter-process communication
  8. You can do this yourself: it’s not fun and it’s not pretty, but you can. Both NOOK Study up through the current version and the original Brackets have done so.But that’s a lot of work, you say. Can’t somebody do that for me??
  9. Hmm. A familiar problem. Wanting to use JavaScript to do something complicated that usually requires a lot of C++. Wanting to do it cross platform. Integrating with the V8 JavaScript engine…
  10. It gives you the raw tools to do things manually