SlideShare uma empresa Scribd logo
1 de 45
1   © 2011 Hewlett-Packard Development Company, L.P.
The JavaScript
                                       Behind HP webOS:
                                        Enyo and Node.js
Ben Combee,
API Czar & Developer Advocate
Frameworks Team, webOS Software Group




2   © 2011 Hewlett-Packard Development Company, L.P.
$99
                                                       16GB




3   © 2011 Hewlett-Packard Development Company, L.P.
$149
                                                       32GB




4   © 2011 Hewlett-Packard Development Company, L.P.
$250
                                                       eBay
                                                       L@@K!
                                                       LIMITED
                                                       EDITION

5   © 2011 Hewlett-Packard Development Company, L.P.
6   © 2011 Hewlett-Packard Development Company, L.P.
HP webOS Architecture

                                                             webOS Service Bus

                                                                                         JS Service
        Web App                                        “Hybrid” App       Compiled App
                                                                                                       Built-in
                                                                                          Node.js     webOS
                                                                                          Service     Services
          Web App Runtime                                             Compiled App
                                                                                          Runtime
           (WebKit + v8)                                                Runtime


                                             UI System Manager                            Activity Manager


                                                       Low-level OS Components (Linux)



7   © 2011 Hewlett-Packard Development Company, L.P.
8   © 2011 Hewlett-Packard Development Company, L.P.
Why Should I Care?

“…webOS, the OS itself, is an incredibly efficient Web-oriented
  operating system. But sitting on top of webOS is even more important,
  and that’s the development environment called Enyo …. It is the
  leading Web app development environment today. We can deploy
  Web applications on webOS. We can deploy on top of Android, iOS, or
  Windows. So what this gives the development community is a
  common platform for which they can develop applications and deploy
  them on the operating system of choice”
                   -- Shane Robison
                      Exec VP and Chief Strategy and Technology Officer, HP

(http://www.crn.com/news/applications-os/231601470/hp-committed-to-webos-as-enterprise-development-platform.htm)




9   © 2011 Hewlett-Packard Development Company, L.P.
                                                                                                       9
Enyo Applications




10   © 2011 Hewlett-Packard Development Company, L.P.
                                                        10
Enyo Applications




11   © 2011 Hewlett-Packard Development Company, L.P.
                                                        11
Enyo Applications




12   © 2011 Hewlett-Packard Development Company, L.P.
                                                        12
Enyo Applications




13   © 2011 Hewlett-Packard Development Company, L.P.
                                                        13
Enyo Applications




14   © 2011 Hewlett-Packard Development Company, L.P.
                                                        14
Enyo Applications




15   © 2011 Hewlett-Packard Development Company, L.P.
                                                        15
Enyo Applications




16   © 2011 Hewlett-Packard Development Company, L.P.
                                                        16
Enyo Applications




17   © 2011 Hewlett-Packard Development Company, L.P.
                                                        17
Enyo Applications




18   © 2011 Hewlett-Packard Development Company, L.P.
                                                        18
Target Application Developers




19   © 2011 Hewlett-Packard Development Company, L.P.
Code Reuse Through Components




                                                        http://www.flickr.com/photos/hugosimmelink/1506521934
20   © 2011 Hewlett-Packard Development Company, L.P.
Prefer JavaScript Over HTML




{ “js” } > <html>

21   © 2011 Hewlett-Packard Development Company, L.P.
Support Flexible Layouts




     HFlexBox                                           VFlexBox   Absolute   Nested



22   © 2011 Hewlett-Packard Development Company, L.P.
Interoperate with GUI Tools like Ares




23   © 2011 Hewlett-Packard Development Company, L.P.
Anatomy of an Enyo App




24   © 2011 Hewlett-Packard Development Company, L.P.
                                                        24
Anatomy of a Enyo Application
– appinfo.json
     •   Standard webOS application metadata, not needed for use in browser

– index.html
     •   Initial page loaded by system manager, pulls in enyo framework and creates app
         object

– depends.js
     •   Loaded by enyo.js, JS code to declare what other files are needed for your app

– app.js
     •   Main application object

– app.css
     •   Any styles needed specifically for your application




25   © 2011 Hewlett-Packard Development Company, L.P.
appinfo.json
{ "id": "com.palmdts.enyo.helloworld“,
   "version": "1.0.0",
   "vendor": "HP“,
   "type": "web“,
   "main": "index.html“,
   "title": "Enyo HelloWorld“,
   "icon": "icon.png“,
   "uiRevision": 2 }




26   © 2011 Hewlett-Packard Development Company, L.P.
app.js
enyo.kind({
   name: "enyo.Canon.HelloWorld",
   kind: enyo.Control,
   content: "Hello World!"});


– This declares a new constructor “HelloWorld”, defined as a property of
  the enyo.Canon object.
– Your app is it’s own kind, and it gets rendered into your document
  body by script in your index.html
– Kinds can own other objects in a complex hierarchy of controls and
  events




27   © 2011 Hewlett-Packard Development Company, L.P.
Example of Application Structure
components: [
  {kind: "AppMenu", components: [
    {caption: "Show on One Page", onclick: "showOnePage"}]},
  {kind: "VFlexBox", width: "320px",
    style: "border-right: 1px solid gray;",
    components: [
      {kind: "RadioGroup", style: "padding: 10px;",
       onChange: "radioGroupChange", components: [
         {caption: "Packages", flex: 1},
         {caption: "Index", flex: 1} ]},
       {kind: "Pane", flex: 1, onclick: "tocClick",
         className: "selectable",
         domAttributes: {"enyo-pass-events": true},
……




28   © 2011 Hewlett-Packard Development Company, L.P.
index.html
<!doctype html>
 <html><head>
   <title>enyo HelloWorld</title>
   <script src=“../0.10/framework/enyo.js”></script>
 </head>
 <body>
   <script type="text/javascript">
     new enyo.Canon.HelloWorld().
       renderInto(document.body);
   </script>
 </body></html>
– Can add launch=“debug” to <script> tag to load all framework source




29   © 2011 Hewlett-Packard Development Company, L.P.
Kinds and Inheritance
– Each kind has a parent kind
– When overridding a method from parent, can call
  this.inherited(arguments) to call parent’s implementation
– enyo.Object is base of the tree
– set/get/changed methods created for each property
– enyo.Component is base of all items that go into app tree
– Components can own a nested collection of objects
– Components have a “$” hash of all owned objects by name, e.g.
  this.$.button.setEnabled(true)




30   © 2011 Hewlett-Packard Development Company, L.P.
Lots of APIs
– Object Oriented Programming & Components
– DOM Utilities & User Interface Generation
– Buttons & Input Controls
– Dialogs, Popups, and Toasters
– Lists and Repeaters
– Web Services and Databases
– Globalization
– webOS Platform Support



31   © 2011 Hewlett-Packard Development Company, L.P.
32   © 2011 Hewlett-Packard Development Company, L.P.
We’re Still Hard at Work

– Improving webOS for TouchPad software updates
– Making Enyo work better on iOS and Android
– Supporting Enyo as great app environment for the desktop browser
– Building World-class developer tools with Ares 2




33   © 2011 Hewlett-Packard Development Company, L.P.
                                                        33
34   © 2011 Hewlett-Packard Development Company, L.P.
Node.js and System Services




35   © 2011 Hewlett-Packard Development Company, L.P.
HP webOS Architecture

                                                              webOS Service Bus

                                                                                          JS Service
         Web App                                        “Hybrid” App       Compiled App
                                                                                                        Built-in
                                                                                           Node.js     webOS
                                                                                           Service     Services
           Web App Runtime                                             Compiled App
                                                                                           Runtime
            (WebKit + v8)                                                Runtime


                                              UI System Manager                            Activity Manager


                                                        Low-level OS Components (Linux)



36   © 2011 Hewlett-Packard Development Company, L.P.
webOS as a Mobile Browser OS

– webOS device is a combination browser, server, and cache
– Apps run in cards (think tabs in your desktop browser)
– Secret to effective multitasking!
– Apps can talk to system services, application services, or outside web
  servers
– Local services use Palm system bus for instead of HTTP




37   © 2011 Hewlett-Packard Development Company, L.P.
                                                        37
webOS Service Bus

– Only exposed on the device
– Point to point connections
– Named services using palm:// URL format
– JSON required for data transport
– Subscription support for getting status updates
– Built-in security and application authentication
– Can be used for both web and PDK applications




38   © 2011 Hewlett-Packard Development Company, L.P.
                                                        38
Example: Opening a URL

# luna-send -P -n 1 -a com.palmdts.launcher
  palm://com.palm.applicationManager/open
  '{"target":"http://2011.texasjavascript.com/"}'
{ "processId": "success", "returnValue": true }


– Public and private buses
– URL-based targets, JSON-based payloads
– Can get one or many responses
– luna-send is the services equivalent of “curl”




39   © 2011 Hewlett-Packard Development Company, L.P.
                                                        39
Why Write a Service?

– Run code without showing a card user interface
– Process lots of data without blocking the UI
– Full access to the USB file system
– Cache data from web services for use when offline
– Integration with HP Synergy to provision contacts, calendar, email,
  messaging, and media sharing




40   © 2011 Hewlett-Packard Development Company, L.P.
                                                        40
Implementing Your Own Services

– Node.js 0.2.3 used as service execution engine
– node 0.4.11 coming in next webOS update
– services.json file maps service IDs to JavaScript constructors
– Services can use node.js built-in methods or webOS-specific
  Foundation classes
– Service calls use a futures-based framework to manage request &
  responses
– Services shut down when inactive to save power & memory




41   © 2011 Hewlett-Packard Development Company, L.P.
                                                        41
Fortune Cookie Demo!




42   © 2011 Hewlett-Packard Development Company, L.P.
developer.hpwebos.com

                                            pdc@palm.com


43   © 2011 Hewlett-Packard Development Company, L.P.
@webOSzombie

                                                        MOAR TOUCHPADS BEING
                                                        MADE!!!!!!!!! WEBOS ZOMBIE IS
                                                        UNSTOPPABLE AAAHHH!!!

                                                        NOTHING SAYS "DEAD
                                                        PLATFORM" QUITE LIKE
                                                        PEOPLE LINING UP TO BUY IT




44   © 2011 Hewlett-Packard Development Company, L.P.
45   © 2011 Hewlett-Packard Development Company, L.P.

Mais conteúdo relacionado

Mais procurados

Getting started with PhoneGap
Getting started with PhoneGapGetting started with PhoneGap
Getting started with PhoneGap
Mihai Corlan
 
RIM Casual Meetup - Bandung #DevIDBdg
RIM Casual Meetup - Bandung #DevIDBdgRIM Casual Meetup - Bandung #DevIDBdg
RIM Casual Meetup - Bandung #DevIDBdg
Ziyad Bazed
 
Develop mobile applications with Flex
Develop mobile applications with FlexDevelop mobile applications with Flex
Develop mobile applications with Flex
ConFoo
 
Cross-Platform Mobile Development in Visual Studio
Cross-Platform Mobile Development in Visual StudioCross-Platform Mobile Development in Visual Studio
Cross-Platform Mobile Development in Visual Studio
bryan costanich
 

Mais procurados (19)

Composer for Magento 1.x and Magento 2
Composer for Magento 1.x and Magento 2Composer for Magento 1.x and Magento 2
Composer for Magento 1.x and Magento 2
 
PHP on Windows
PHP on WindowsPHP on Windows
PHP on Windows
 
Getting started with PhoneGap
Getting started with PhoneGapGetting started with PhoneGap
Getting started with PhoneGap
 
BlackBerry WebWorks
BlackBerry WebWorksBlackBerry WebWorks
BlackBerry WebWorks
 
RIM Casual Meetup - Bandung #DevIDBdg
RIM Casual Meetup - Bandung #DevIDBdgRIM Casual Meetup - Bandung #DevIDBdg
RIM Casual Meetup - Bandung #DevIDBdg
 
Escaping the yellow bubble - rewriting Domino using MongoDb and Angular
Escaping the yellow bubble - rewriting Domino using MongoDb and AngularEscaping the yellow bubble - rewriting Domino using MongoDb and Angular
Escaping the yellow bubble - rewriting Domino using MongoDb and Angular
 
Modern JavaScript Frameworks: Angular, React & Vue.js
Modern JavaScript Frameworks: Angular, React & Vue.jsModern JavaScript Frameworks: Angular, React & Vue.js
Modern JavaScript Frameworks: Angular, React & Vue.js
 
Develop mobile applications with Flex
Develop mobile applications with FlexDevelop mobile applications with Flex
Develop mobile applications with Flex
 
Desktop apps with node webkit
Desktop apps with node webkitDesktop apps with node webkit
Desktop apps with node webkit
 
REST easy with API Platform
REST easy with API PlatformREST easy with API Platform
REST easy with API Platform
 
Web Apps and more
Web Apps and moreWeb Apps and more
Web Apps and more
 
Frontend Monoliths: Run if you can!
Frontend Monoliths: Run if you can!Frontend Monoliths: Run if you can!
Frontend Monoliths: Run if you can!
 
DotNet Cologne 2015 - Windows 10 AppDev, Teil1: App Developer Basics- (Daniel...
DotNet Cologne 2015 - Windows 10 AppDev, Teil1: App Developer Basics- (Daniel...DotNet Cologne 2015 - Windows 10 AppDev, Teil1: App Developer Basics- (Daniel...
DotNet Cologne 2015 - Windows 10 AppDev, Teil1: App Developer Basics- (Daniel...
 
Using API Platform to build ticketing system #symfonycon
Using API Platform to build ticketing system #symfonyconUsing API Platform to build ticketing system #symfonycon
Using API Platform to build ticketing system #symfonycon
 
Using API platform to build ticketing system (translations, time zones, ...) ...
Using API platform to build ticketing system (translations, time zones, ...) ...Using API platform to build ticketing system (translations, time zones, ...) ...
Using API platform to build ticketing system (translations, time zones, ...) ...
 
ASP Dot Net Software Development in India - iFour Technolab
ASP Dot Net Software Development in India - iFour TechnolabASP Dot Net Software Development in India - iFour Technolab
ASP Dot Net Software Development in India - iFour Technolab
 
Cross-Platform Mobile Development in Visual Studio
Cross-Platform Mobile Development in Visual StudioCross-Platform Mobile Development in Visual Studio
Cross-Platform Mobile Development in Visual Studio
 
Transforming the web into a real application platform
Transforming the web into a real application platformTransforming the web into a real application platform
Transforming the web into a real application platform
 
HTML5 WebWorks
HTML5 WebWorksHTML5 WebWorks
HTML5 WebWorks
 

Semelhante a CapitolJS: Enyo, Node.js, & the State of webOS

Flex 4.5 and mobile development
Flex 4.5 and mobile developmentFlex 4.5 and mobile development
Flex 4.5 and mobile development
Michael Chaize
 
Building Native Mobile Applications with PhoneGap
Building Native Mobile Applications with PhoneGapBuilding Native Mobile Applications with PhoneGap
Building Native Mobile Applications with PhoneGap
Simon MacDonald
 
Hybrid Mobile Apps - Meetup
Hybrid Mobile Apps - MeetupHybrid Mobile Apps - Meetup
Hybrid Mobile Apps - Meetup
Sanjay Patel
 
Web development meetingup
Web development meetingupWeb development meetingup
Web development meetingup
PiTechnologies
 
Html5 overview
Html5 overviewHtml5 overview
Html5 overview
appbackr
 
Forrester reviews the KonyOne platform
Forrester reviews the KonyOne platformForrester reviews the KonyOne platform
Forrester reviews the KonyOne platform
Kony, Inc.
 
Integrating ADF Mobile with WebCenter
Integrating ADF Mobile with WebCenterIntegrating ADF Mobile with WebCenter
Integrating ADF Mobile with WebCenter
Brian Huff
 

Semelhante a CapitolJS: Enyo, Node.js, & the State of webOS (20)

Flex 4.5 and mobile development
Flex 4.5 and mobile developmentFlex 4.5 and mobile development
Flex 4.5 and mobile development
 
Developing mobile applications for i using open source tools Venna 2012
Developing mobile applications for i using open source tools  Venna 2012Developing mobile applications for i using open source tools  Venna 2012
Developing mobile applications for i using open source tools Venna 2012
 
Building Native Mobile Applications with PhoneGap
Building Native Mobile Applications with PhoneGapBuilding Native Mobile Applications with PhoneGap
Building Native Mobile Applications with PhoneGap
 
Hybrid Mobile Apps - Meetup
Hybrid Mobile Apps - MeetupHybrid Mobile Apps - Meetup
Hybrid Mobile Apps - Meetup
 
Android Development with Flash Platform
Android Development with Flash PlatformAndroid Development with Flash Platform
Android Development with Flash Platform
 
IONIC VS. REACT NATIVE – WHICH FRAMEWORK IS BETTER FOR CROSS-PLATFORM MOBILE ...
IONIC VS. REACT NATIVE – WHICH FRAMEWORK IS BETTER FOR CROSS-PLATFORM MOBILE ...IONIC VS. REACT NATIVE – WHICH FRAMEWORK IS BETTER FOR CROSS-PLATFORM MOBILE ...
IONIC VS. REACT NATIVE – WHICH FRAMEWORK IS BETTER FOR CROSS-PLATFORM MOBILE ...
 
Hybridapp
HybridappHybridapp
Hybridapp
 
Montpellier - Flex UG
Montpellier - Flex UGMontpellier - Flex UG
Montpellier - Flex UG
 
App developer as a Web developer (ROROSyd - Jul 15)
App developer as a Web developer (ROROSyd - Jul 15)App developer as a Web developer (ROROSyd - Jul 15)
App developer as a Web developer (ROROSyd - Jul 15)
 
Worklight technical intro v2
Worklight technical intro v2Worklight technical intro v2
Worklight technical intro v2
 
Web development meetingup
Web development meetingupWeb development meetingup
Web development meetingup
 
Mobile Web Apps
Mobile Web AppsMobile Web Apps
Mobile Web Apps
 
Ionic vs flutter best platform for hybrid app development
Ionic vs flutter  best platform for hybrid app developmentIonic vs flutter  best platform for hybrid app development
Ionic vs flutter best platform for hybrid app development
 
webinos whitepaper
webinos whitepaperwebinos whitepaper
webinos whitepaper
 
Html5 overview
Html5 overviewHtml5 overview
Html5 overview
 
Native script vs react native for native app development in 2022
Native script vs react native for native app development in 2022Native script vs react native for native app development in 2022
Native script vs react native for native app development in 2022
 
Adobe flex at jax london 2011
Adobe flex at  jax london 2011Adobe flex at  jax london 2011
Adobe flex at jax london 2011
 
Project Zero Php Quebec
Project Zero Php QuebecProject Zero Php Quebec
Project Zero Php Quebec
 
Forrester reviews the KonyOne platform
Forrester reviews the KonyOne platformForrester reviews the KonyOne platform
Forrester reviews the KonyOne platform
 
Integrating ADF Mobile with WebCenter
Integrating ADF Mobile with WebCenterIntegrating ADF Mobile with WebCenter
Integrating ADF Mobile with WebCenter
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
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
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 

CapitolJS: Enyo, Node.js, & the State of webOS

  • 1. 1 © 2011 Hewlett-Packard Development Company, L.P.
  • 2. The JavaScript Behind HP webOS: Enyo and Node.js Ben Combee, API Czar & Developer Advocate Frameworks Team, webOS Software Group 2 © 2011 Hewlett-Packard Development Company, L.P.
  • 3. $99 16GB 3 © 2011 Hewlett-Packard Development Company, L.P.
  • 4. $149 32GB 4 © 2011 Hewlett-Packard Development Company, L.P.
  • 5. $250 eBay L@@K! LIMITED EDITION 5 © 2011 Hewlett-Packard Development Company, L.P.
  • 6. 6 © 2011 Hewlett-Packard Development Company, L.P.
  • 7. HP webOS Architecture webOS Service Bus JS Service Web App “Hybrid” App Compiled App Built-in Node.js webOS Service Services Web App Runtime Compiled App Runtime (WebKit + v8) Runtime UI System Manager Activity Manager Low-level OS Components (Linux) 7 © 2011 Hewlett-Packard Development Company, L.P.
  • 8. 8 © 2011 Hewlett-Packard Development Company, L.P.
  • 9. Why Should I Care? “…webOS, the OS itself, is an incredibly efficient Web-oriented operating system. But sitting on top of webOS is even more important, and that’s the development environment called Enyo …. It is the leading Web app development environment today. We can deploy Web applications on webOS. We can deploy on top of Android, iOS, or Windows. So what this gives the development community is a common platform for which they can develop applications and deploy them on the operating system of choice” -- Shane Robison Exec VP and Chief Strategy and Technology Officer, HP (http://www.crn.com/news/applications-os/231601470/hp-committed-to-webos-as-enterprise-development-platform.htm) 9 © 2011 Hewlett-Packard Development Company, L.P. 9
  • 10. Enyo Applications 10 © 2011 Hewlett-Packard Development Company, L.P. 10
  • 11. Enyo Applications 11 © 2011 Hewlett-Packard Development Company, L.P. 11
  • 12. Enyo Applications 12 © 2011 Hewlett-Packard Development Company, L.P. 12
  • 13. Enyo Applications 13 © 2011 Hewlett-Packard Development Company, L.P. 13
  • 14. Enyo Applications 14 © 2011 Hewlett-Packard Development Company, L.P. 14
  • 15. Enyo Applications 15 © 2011 Hewlett-Packard Development Company, L.P. 15
  • 16. Enyo Applications 16 © 2011 Hewlett-Packard Development Company, L.P. 16
  • 17. Enyo Applications 17 © 2011 Hewlett-Packard Development Company, L.P. 17
  • 18. Enyo Applications 18 © 2011 Hewlett-Packard Development Company, L.P. 18
  • 19. Target Application Developers 19 © 2011 Hewlett-Packard Development Company, L.P.
  • 20. Code Reuse Through Components http://www.flickr.com/photos/hugosimmelink/1506521934 20 © 2011 Hewlett-Packard Development Company, L.P.
  • 21. Prefer JavaScript Over HTML { “js” } > <html> 21 © 2011 Hewlett-Packard Development Company, L.P.
  • 22. Support Flexible Layouts HFlexBox VFlexBox Absolute Nested 22 © 2011 Hewlett-Packard Development Company, L.P.
  • 23. Interoperate with GUI Tools like Ares 23 © 2011 Hewlett-Packard Development Company, L.P.
  • 24. Anatomy of an Enyo App 24 © 2011 Hewlett-Packard Development Company, L.P. 24
  • 25. Anatomy of a Enyo Application – appinfo.json • Standard webOS application metadata, not needed for use in browser – index.html • Initial page loaded by system manager, pulls in enyo framework and creates app object – depends.js • Loaded by enyo.js, JS code to declare what other files are needed for your app – app.js • Main application object – app.css • Any styles needed specifically for your application 25 © 2011 Hewlett-Packard Development Company, L.P.
  • 26. appinfo.json { "id": "com.palmdts.enyo.helloworld“, "version": "1.0.0", "vendor": "HP“, "type": "web“, "main": "index.html“, "title": "Enyo HelloWorld“, "icon": "icon.png“, "uiRevision": 2 } 26 © 2011 Hewlett-Packard Development Company, L.P.
  • 27. app.js enyo.kind({ name: "enyo.Canon.HelloWorld", kind: enyo.Control, content: "Hello World!"}); – This declares a new constructor “HelloWorld”, defined as a property of the enyo.Canon object. – Your app is it’s own kind, and it gets rendered into your document body by script in your index.html – Kinds can own other objects in a complex hierarchy of controls and events 27 © 2011 Hewlett-Packard Development Company, L.P.
  • 28. Example of Application Structure components: [ {kind: "AppMenu", components: [ {caption: "Show on One Page", onclick: "showOnePage"}]}, {kind: "VFlexBox", width: "320px", style: "border-right: 1px solid gray;", components: [ {kind: "RadioGroup", style: "padding: 10px;", onChange: "radioGroupChange", components: [ {caption: "Packages", flex: 1}, {caption: "Index", flex: 1} ]}, {kind: "Pane", flex: 1, onclick: "tocClick", className: "selectable", domAttributes: {"enyo-pass-events": true}, …… 28 © 2011 Hewlett-Packard Development Company, L.P.
  • 29. index.html <!doctype html> <html><head> <title>enyo HelloWorld</title> <script src=“../0.10/framework/enyo.js”></script> </head> <body> <script type="text/javascript"> new enyo.Canon.HelloWorld(). renderInto(document.body); </script> </body></html> – Can add launch=“debug” to <script> tag to load all framework source 29 © 2011 Hewlett-Packard Development Company, L.P.
  • 30. Kinds and Inheritance – Each kind has a parent kind – When overridding a method from parent, can call this.inherited(arguments) to call parent’s implementation – enyo.Object is base of the tree – set/get/changed methods created for each property – enyo.Component is base of all items that go into app tree – Components can own a nested collection of objects – Components have a “$” hash of all owned objects by name, e.g. this.$.button.setEnabled(true) 30 © 2011 Hewlett-Packard Development Company, L.P.
  • 31. Lots of APIs – Object Oriented Programming & Components – DOM Utilities & User Interface Generation – Buttons & Input Controls – Dialogs, Popups, and Toasters – Lists and Repeaters – Web Services and Databases – Globalization – webOS Platform Support 31 © 2011 Hewlett-Packard Development Company, L.P.
  • 32. 32 © 2011 Hewlett-Packard Development Company, L.P.
  • 33. We’re Still Hard at Work – Improving webOS for TouchPad software updates – Making Enyo work better on iOS and Android – Supporting Enyo as great app environment for the desktop browser – Building World-class developer tools with Ares 2 33 © 2011 Hewlett-Packard Development Company, L.P. 33
  • 34. 34 © 2011 Hewlett-Packard Development Company, L.P.
  • 35. Node.js and System Services 35 © 2011 Hewlett-Packard Development Company, L.P.
  • 36. HP webOS Architecture webOS Service Bus JS Service Web App “Hybrid” App Compiled App Built-in Node.js webOS Service Services Web App Runtime Compiled App Runtime (WebKit + v8) Runtime UI System Manager Activity Manager Low-level OS Components (Linux) 36 © 2011 Hewlett-Packard Development Company, L.P.
  • 37. webOS as a Mobile Browser OS – webOS device is a combination browser, server, and cache – Apps run in cards (think tabs in your desktop browser) – Secret to effective multitasking! – Apps can talk to system services, application services, or outside web servers – Local services use Palm system bus for instead of HTTP 37 © 2011 Hewlett-Packard Development Company, L.P. 37
  • 38. webOS Service Bus – Only exposed on the device – Point to point connections – Named services using palm:// URL format – JSON required for data transport – Subscription support for getting status updates – Built-in security and application authentication – Can be used for both web and PDK applications 38 © 2011 Hewlett-Packard Development Company, L.P. 38
  • 39. Example: Opening a URL # luna-send -P -n 1 -a com.palmdts.launcher palm://com.palm.applicationManager/open '{"target":"http://2011.texasjavascript.com/"}' { "processId": "success", "returnValue": true } – Public and private buses – URL-based targets, JSON-based payloads – Can get one or many responses – luna-send is the services equivalent of “curl” 39 © 2011 Hewlett-Packard Development Company, L.P. 39
  • 40. Why Write a Service? – Run code without showing a card user interface – Process lots of data without blocking the UI – Full access to the USB file system – Cache data from web services for use when offline – Integration with HP Synergy to provision contacts, calendar, email, messaging, and media sharing 40 © 2011 Hewlett-Packard Development Company, L.P. 40
  • 41. Implementing Your Own Services – Node.js 0.2.3 used as service execution engine – node 0.4.11 coming in next webOS update – services.json file maps service IDs to JavaScript constructors – Services can use node.js built-in methods or webOS-specific Foundation classes – Service calls use a futures-based framework to manage request & responses – Services shut down when inactive to save power & memory 41 © 2011 Hewlett-Packard Development Company, L.P. 41
  • 42. Fortune Cookie Demo! 42 © 2011 Hewlett-Packard Development Company, L.P.
  • 43. developer.hpwebos.com pdc@palm.com 43 © 2011 Hewlett-Packard Development Company, L.P.
  • 44. @webOSzombie MOAR TOUCHPADS BEING MADE!!!!!!!!! WEBOS ZOMBIE IS UNSTOPPABLE AAAHHH!!! NOTHING SAYS "DEAD PLATFORM" QUITE LIKE PEOPLE LINING UP TO BUY IT 44 © 2011 Hewlett-Packard Development Company, L.P.
  • 45. 45 © 2011 Hewlett-Packard Development Company, L.P.