SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Andere mochten auch

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
 

Andere mochten auch (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Mehr von Domenic Denicola

Mehr von 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
 

Kürzlich hochgeladen

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
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
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
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
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
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
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 

Kürzlich hochgeladen (20)

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
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
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
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
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 

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

Hinweis der Redaktion

  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