SlideShare a Scribd company logo
1 of 63
Cross-Platform Web
 Applications With
    PhoneGap
      Brian LeRoux
Brian LeRoux

• Nitobi Software, Vancouver
• Mostly JavaScript things
Nitobi Software

• All about the web
• With an open source focus
• Consulting / support / training
http://phonegap.com

•   http://nitobi.com
•   http://twitter.com/brianleroux
•   http://brianleroux.github.com
•   http://wtfjs.com
•   http://crockfordfacts.com
Problems

• Native apps fragmentation
• DOM libraries in mobile web apps
• Offline storage
Solutions

• PhoneGap
• XUI
• Lawnchair
PhoneGap

• Project philosophy
• History
• The future
3.3.1
Fragmentation Problem

   Apple iPhone OS         Objective C

   Google Android          Dalvik Java

   RIM Blackberry          J2ME Java

   Nokia Symbian / MeeGo   *

   Palm webOS              web

   Windows Mobile/Phone    C,C++,C# (.NET)
Distribution is also
   a nightmare.
Cross Platform

• Write once
• Debug everywhere
• Never works...except that whole Internet thing
The Web Is a First-class Dev Platform

• Access to native device APIs
• Access to device data
• Great tooling: debugging, logging, testing,
  emulation,
  and other instrumentation
OS Support

• Apple iPhone
• Google Android
• RIM Blackberry
• Palm webOS
• Symbian
• Maemo / MeeGo
• Windows Mobile / Phone

 See http://rubyurl.com/jtNs
Device APIs / Data

• Geo
• Accelerometer
• Camera / photos
• Vibration
• Contacts
• SMS / telephony
• Sound / video
• Reachability
• Magnometer
• Plus, anything a browser can do
PhoneGap does not
   prevent you from
augmenting with native
     capabilities.
PhoneGap Projects

• Have a www folder somewhere
• index.html
• Include a phonegap.js
The PhoneGap Technique

• Create a browser instance
• Exec JavaScript from native code
• Exec native code from JavaScript
mobile-spec
Standards

• http://www.w3.org/2009/dap/
• http://dev.w3.org/html5/spec/Overview.html
• http://www.w3.org/TR/widgets/



 Favouring compliance over conformance.
MIT Licensed
Governance

• Looking to contribute
  to a foundation
• Symbian has accepted
  PhoneGap/Symbian
• May create a
  foundation
The “Roadmap”

• PhoneGap 1.0
• PhoneGap 1.1
• PhoneGap 2.0
• Also: http://wiki.phonegap.com/Roadmap
PhoneGap 1.0

• Ratified the messaging API
• Inclusion of xmpp
• Native maps
• File I/O
• Docs!
PhoneGap 1.1

• Bondi APIs
• commonjs require / modules
• Samsung bada
• Notifications API
  (w/ Urban Airship)
PhoneGap 2.0

• More native access
• Better rendering options
• More platforms
• A pony, perhaps
Handy Resources

•   http://groups.google.com/group/phonegap
•   http://wiki.phonegap.com
•   http://twitter.com/phonegap
•   #phonegap on http://irc.freenode.net
Tooling / Automation

• phonegap-dev
• ./droidscript
• ibug
XUI
A micro tiny JavaScript Framework
Why?!?
Some Reasons

• Small screens
• Limited CPU
• Limited RAM
• Limited storage
• Sketch connectivity
Consider

• jQuery 40+ kb
• Dojo 25+ kb
• YUI/MooTools/Etc same difference
Good Times for WebKit

• Apple iPhone OS
• Google Android OS
• Palm webOS




 http://quirksmode.org/m/table.html
Then, We Gave Up

• Windows Mobile is IE4 or 6/7
• Nokia Symbian is an early WebKit
• RIM Blackberry is an unholy mess
Patterns Emerged
XUI Was Born (2008)

• Between 2 and 3 kb
• DOM concerns only
• Chainable syntax (it was trendy)
• Conditional builds over conditional code
XUI is NOT a set of GUI
 controls or widgets.
Selectors

// basic matches by selector
x$('div.foo');
x$('ul#global-nav li.selected');

// element literals
x$(window);
x$(document);

// lists of elements
x$('li', 'div');

// arrays even
x$(['div#foo', 'div.bar']);
Chaining




// method chaining
x$('ul#nav li a:first').html('hey there').css({color:'blue'});
Helpful Stuff



// helpful DOM node filtering
x$('ul li').has('ul li.selected');
x$('ul li').not('ul li.selected');

// classic iteration
x$('.book').each(function() { ... });
DOM Manipulation
// DOM manipulation basics
x$('#protection').html( '<strong>for hard wood</strong>' );

// other hacky ways to hack around
x$('#title').html( 'after', '<p>B.Sc</p>' );

// implicit node creation
x$("<p id='foo'></p>").html('bar'); // <p id="foo">bar</p>

// inner, outer, top, bottom, before, after
x$('#shortcuts').bottom('make life so easy!')

// guess what this does?
x$('#iehack').remove();

// getter
var aboutUrl = x$('a.about').attr('href');

// setter
x$('a.mysite').attr('href','http://westcoastlogic.com');
Styles and CSS

   // Manipulate style
   //
   // dangerously set style properties
   x$('a.fugly').css({color:'blue'});

   // probably better
   x$('#basic').addClass('selected');

   // nice conditional callback syntax
   x$('#feet').hasClass('smelly', function(){
       x$(this).removeClass('stinky');
   });
Eventing

• click <--bad!
• load <--questionable!
• touchstart, touchmove, touchend, touchcancel
• guesturestart, guesturechange, guestureend
• orientationchange
• deviceready
Special Effects




 // basic animation support by way of Emile
 x$('#fx').tween({background:'red', duration:1.5 });
Alternatives

• Develop for Palm exclusively
• jQtouch
• Dashcode <-- Ugh! No!!
• Scroll Touch by Uxebu
Emerging Techniques

• Single page apps via index.html
• Lazy eval JavaScript
• Conditional builds for JavaScript logic
Lawnchair
PhoneGap apps are
intrinsically offline.
Going Offline

• Web apps: Cache Manifest
• Hybrid apps: Reachability API
Once You Are Offline

• Cookies
• DOM storage
• SQLite
• Other hacks: flash, window.name, etc.
Ghetto, Actually

• DOM Storage is key/value
  only; Slightly nicer than
  cookies but way lamer
  name
• SQLite seems like a bad
  idea: schemas, migrations,
  impedance mismatch, oh
  my
Lawnchair Quickly

• JSON document store (not key/value)
• Designed for mobile; very light
• Clean and simple async oo API
• Adaptor pattern for store customization
Pull up a Lawnchair!




var people = new Lawnchair({adaptor:'dom'});
Adding Records

  // Saving a document
  var me = {name:'brian'};
  people.save(me);


  // Saving a document async
  people.save({name:'frank'}, function(r) {
      console.log(r);
  });


  // Specifying your own key
  people.save({key:'whatever', name:'dracula'});
Finding Records
   // Get that document
   people.get(me.key, function(r){
       console.log(r);
   });


   // Returns all documents as an array to a
   callback
   people.all(function(r){
       console.log(r);
   });


   // List all with shortcut syntax
   people.all('console.log(r)');
Removing Records

   // Remove a document directly
   people.get(me.key, function(r){
       people.remove(me);
   });

   // Remove a document by key
   people.save({key:'die', name:'duder'});
   people.remove('die');

   // Destroy all documents
   people.nuke();
Helpful Stuff

// Classic iteration
people.each(function(r){
    console.log(r);
});


// Classic with terse shorthand syntax
people.each('console.log(r)');
Searching / Finding
// Iterate documents conditionally!
// The first function is a conditional.
// The second is a callback exec on records returned by the first
people.find(
    function(r) {return r.name == brian},
    function(r) {console.log(r)}
);

// Iterate conditionally via shorthand
people.find('r.name == "brian"', 'console.log(r)');


// You can mix and match shorthand btw
people.find('r.name == "brian"', function(r){
    console.log(r)
});
Thanks!

          Time for a coffee?
Q &A
Palm Developer Day PhoneGap

More Related Content

What's hot

The ideal module system and the harsh reality
The ideal module system and the harsh realityThe ideal module system and the harsh reality
The ideal module system and the harsh reality
Adam Warski
 

What's hot (18)

Modern php
Modern phpModern php
Modern php
 
CSS 201
CSS 201CSS 201
CSS 201
 
Web Frameworks
Web FrameworksWeb Frameworks
Web Frameworks
 
Introduction to NodeJS with LOLCats
Introduction to NodeJS with LOLCatsIntroduction to NodeJS with LOLCats
Introduction to NodeJS with LOLCats
 
Geecon 2019 - Taming Code Quality in the Worst Language I Know: Bash
Geecon 2019 - Taming Code Quality  in the Worst Language I Know: BashGeecon 2019 - Taming Code Quality  in the Worst Language I Know: Bash
Geecon 2019 - Taming Code Quality in the Worst Language I Know: Bash
 
The ideal module system and the harsh reality
The ideal module system and the harsh realityThe ideal module system and the harsh reality
The ideal module system and the harsh reality
 
Maintainable JavaScript 2012
Maintainable JavaScript 2012Maintainable JavaScript 2012
Maintainable JavaScript 2012
 
Php converted pdf
Php converted pdfPhp converted pdf
Php converted pdf
 
Ppt php
Ppt phpPpt php
Ppt php
 
The no-framework Scala Dependency Injection Framework
The no-framework Scala Dependency Injection FrameworkThe no-framework Scala Dependency Injection Framework
The no-framework Scala Dependency Injection Framework
 
NYPHP March 2009 Presentation
NYPHP March 2009 PresentationNYPHP March 2009 Presentation
NYPHP March 2009 Presentation
 
Learning to code
Learning to codeLearning to code
Learning to code
 
Node.js Patterns and Opinions
Node.js Patterns and OpinionsNode.js Patterns and Opinions
Node.js Patterns and Opinions
 
Mining Ruby Gem vulnerabilities for Fun and No Profit.
Mining Ruby Gem vulnerabilities for Fun and No Profit.Mining Ruby Gem vulnerabilities for Fun and No Profit.
Mining Ruby Gem vulnerabilities for Fun and No Profit.
 
Rails ORM De-mystifying Active Record has_many
Rails ORM De-mystifying Active Record has_manyRails ORM De-mystifying Active Record has_many
Rails ORM De-mystifying Active Record has_many
 
Dojo Basics Js UserGroup Chicago
Dojo Basics Js UserGroup ChicagoDojo Basics Js UserGroup Chicago
Dojo Basics Js UserGroup Chicago
 
Extracting ruby gem
Extracting ruby gemExtracting ruby gem
Extracting ruby gem
 
Test legacy apps with Behat
Test legacy apps with BehatTest legacy apps with Behat
Test legacy apps with Behat
 

Viewers also liked

Phonegap deep-dive
Phonegap deep-divePhonegap deep-dive
Phonegap deep-dive
alunny
 
Automated Python Test Frameworks for Hardware Verification and Validation
Automated Python Test Frameworks for Hardware Verification and ValidationAutomated Python Test Frameworks for Hardware Verification and Validation
Automated Python Test Frameworks for Hardware Verification and Validation
Barbara Jones
 

Viewers also liked (12)

DjangoSki
DjangoSkiDjangoSki
DjangoSki
 
Phonegap deep-dive
Phonegap deep-divePhonegap deep-dive
Phonegap deep-dive
 
Human APIs, the future of mobile
Human APIs, the future of mobileHuman APIs, the future of mobile
Human APIs, the future of mobile
 
HTML5 Apps Cross Platform - SWDC 2010, Stockholm
HTML5 Apps Cross Platform - SWDC 2010, StockholmHTML5 Apps Cross Platform - SWDC 2010, Stockholm
HTML5 Apps Cross Platform - SWDC 2010, Stockholm
 
Automated Python Test Frameworks for Hardware Verification and Validation
Automated Python Test Frameworks for Hardware Verification and ValidationAutomated Python Test Frameworks for Hardware Verification and Validation
Automated Python Test Frameworks for Hardware Verification and Validation
 
Sikuli script
Sikuli scriptSikuli script
Sikuli script
 
Automation and machine learning in the enterprise
Automation and machine learning in the enterpriseAutomation and machine learning in the enterprise
Automation and machine learning in the enterprise
 
SikuliX
SikuliXSikuliX
SikuliX
 
Présentation SikuliX
Présentation SikuliXPrésentation SikuliX
Présentation SikuliX
 
Python in Test automation
Python in Test automationPython in Test automation
Python in Test automation
 
Practical Sikuli: using screenshots for GUI automation and testing
Practical Sikuli: using screenshots for GUI automation and testingPractical Sikuli: using screenshots for GUI automation and testing
Practical Sikuli: using screenshots for GUI automation and testing
 
Learn 90% of Python in 90 Minutes
Learn 90% of Python in 90 MinutesLearn 90% of Python in 90 Minutes
Learn 90% of Python in 90 Minutes
 

Similar to Palm Developer Day PhoneGap

Webdevcon Keynote hh-2012-09-18
Webdevcon Keynote hh-2012-09-18Webdevcon Keynote hh-2012-09-18
Webdevcon Keynote hh-2012-09-18
Pierre Joye
 
Windows 8 DevUnleashed - Session 1
Windows 8 DevUnleashed - Session 1Windows 8 DevUnleashed - Session 1
Windows 8 DevUnleashed - Session 1
drudolph11
 
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There TodayHTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
davyjones
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1
Mohammad Qureshi
 

Similar to Palm Developer Day PhoneGap (20)

Android development workshop
Android development workshopAndroid development workshop
Android development workshop
 
Mobile native-hacks
Mobile native-hacksMobile native-hacks
Mobile native-hacks
 
Phonegap 2.x
Phonegap 2.xPhonegap 2.x
Phonegap 2.x
 
Webdevcon Keynote hh-2012-09-18
Webdevcon Keynote hh-2012-09-18Webdevcon Keynote hh-2012-09-18
Webdevcon Keynote hh-2012-09-18
 
WP7, Droid, iPhone, Oh my!
WP7, Droid, iPhone, Oh my!WP7, Droid, iPhone, Oh my!
WP7, Droid, iPhone, Oh my!
 
Node.js: The What, The How and The When
Node.js: The What, The How and The WhenNode.js: The What, The How and The When
Node.js: The What, The How and The When
 
Intro To Node.js
Intro To Node.jsIntro To Node.js
Intro To Node.js
 
Windows 8 DevUnleashed - Session 1
Windows 8 DevUnleashed - Session 1Windows 8 DevUnleashed - Session 1
Windows 8 DevUnleashed - Session 1
 
Using Javascript in today's world
Using Javascript in today's worldUsing Javascript in today's world
Using Javascript in today's world
 
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There TodayHTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1
 
Mobile Device APIs
Mobile Device APIsMobile Device APIs
Mobile Device APIs
 
Jquery fundamentals
Jquery fundamentalsJquery fundamentals
Jquery fundamentals
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
 
JavaScript on the Desktop
JavaScript on the DesktopJavaScript on the Desktop
JavaScript on the Desktop
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
 
Php on the Web and Desktop
Php on the Web and DesktopPhp on the Web and Desktop
Php on the Web and Desktop
 
The Mobile Web Revealed For The Java Developer
The Mobile Web Revealed For The Java DeveloperThe Mobile Web Revealed For The Java Developer
The Mobile Web Revealed For The Java Developer
 
Rhodes And Phone Gap
Rhodes And Phone GapRhodes And Phone Gap
Rhodes And Phone Gap
 
1.6 米嘉 gobuildweb
1.6 米嘉 gobuildweb1.6 米嘉 gobuildweb
1.6 米嘉 gobuildweb
 

More from Brian LeRoux (14)

Future of Mobile
Future of MobileFuture of Mobile
Future of Mobile
 
Mobeers waterloo-2011
Mobeers waterloo-2011Mobeers waterloo-2011
Mobeers waterloo-2011
 
TxJS 2011
TxJS 2011TxJS 2011
TxJS 2011
 
Nitobi/PhoneGap at Bootup 2011
Nitobi/PhoneGap at Bootup 2011Nitobi/PhoneGap at Bootup 2011
Nitobi/PhoneGap at Bootup 2011
 
Falsy Values - Warsaw 2011
Falsy Values - Warsaw 2011Falsy Values - Warsaw 2011
Falsy Values - Warsaw 2011
 
After HTML5 Mobilism 2011
After HTML5 Mobilism 2011After HTML5 Mobilism 2011
After HTML5 Mobilism 2011
 
Mobile Knife Fighting at JSConf US
Mobile Knife Fighting at JSConf US Mobile Knife Fighting at JSConf US
Mobile Knife Fighting at JSConf US
 
Phonegap for Engineers
Phonegap for EngineersPhonegap for Engineers
Phonegap for Engineers
 
Fullfrontal 2010
Fullfrontal 2010Fullfrontal 2010
Fullfrontal 2010
 
Scurvyconf
ScurvyconfScurvyconf
Scurvyconf
 
Mobile Web App Development
Mobile Web App DevelopmentMobile Web App Development
Mobile Web App Development
 
Mobile JavaScript
Mobile JavaScriptMobile JavaScript
Mobile JavaScript
 
Phonegap 1.0
Phonegap 1.0Phonegap 1.0
Phonegap 1.0
 
PhoneGap at JSConf
PhoneGap at JSConfPhoneGap at JSConf
PhoneGap at JSConf
 

Recently uploaded

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
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
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
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
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
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

Palm Developer Day PhoneGap

  • 1.
  • 2. Cross-Platform Web Applications With PhoneGap Brian LeRoux
  • 3. Brian LeRoux • Nitobi Software, Vancouver • Mostly JavaScript things
  • 4. Nitobi Software • All about the web • With an open source focus • Consulting / support / training
  • 5.
  • 6. http://phonegap.com • http://nitobi.com • http://twitter.com/brianleroux • http://brianleroux.github.com • http://wtfjs.com • http://crockfordfacts.com
  • 7. Problems • Native apps fragmentation • DOM libraries in mobile web apps • Offline storage
  • 9. PhoneGap • Project philosophy • History • The future
  • 10. 3.3.1
  • 11. Fragmentation Problem Apple iPhone OS Objective C Google Android Dalvik Java RIM Blackberry J2ME Java Nokia Symbian / MeeGo * Palm webOS web Windows Mobile/Phone C,C++,C# (.NET)
  • 12. Distribution is also a nightmare.
  • 13. Cross Platform • Write once • Debug everywhere • Never works...except that whole Internet thing
  • 14. The Web Is a First-class Dev Platform • Access to native device APIs • Access to device data • Great tooling: debugging, logging, testing, emulation, and other instrumentation
  • 15. OS Support • Apple iPhone • Google Android • RIM Blackberry • Palm webOS • Symbian • Maemo / MeeGo • Windows Mobile / Phone See http://rubyurl.com/jtNs
  • 16. Device APIs / Data • Geo • Accelerometer • Camera / photos • Vibration • Contacts • SMS / telephony • Sound / video • Reachability • Magnometer • Plus, anything a browser can do
  • 17. PhoneGap does not prevent you from augmenting with native capabilities.
  • 18. PhoneGap Projects • Have a www folder somewhere • index.html • Include a phonegap.js
  • 19. The PhoneGap Technique • Create a browser instance • Exec JavaScript from native code • Exec native code from JavaScript
  • 21. Standards • http://www.w3.org/2009/dap/ • http://dev.w3.org/html5/spec/Overview.html • http://www.w3.org/TR/widgets/ Favouring compliance over conformance.
  • 23. Governance • Looking to contribute to a foundation • Symbian has accepted PhoneGap/Symbian • May create a foundation
  • 24. The “Roadmap” • PhoneGap 1.0 • PhoneGap 1.1 • PhoneGap 2.0 • Also: http://wiki.phonegap.com/Roadmap
  • 25. PhoneGap 1.0 • Ratified the messaging API • Inclusion of xmpp • Native maps • File I/O • Docs!
  • 26. PhoneGap 1.1 • Bondi APIs • commonjs require / modules • Samsung bada • Notifications API (w/ Urban Airship)
  • 27. PhoneGap 2.0 • More native access • Better rendering options • More platforms • A pony, perhaps
  • 28. Handy Resources • http://groups.google.com/group/phonegap • http://wiki.phonegap.com • http://twitter.com/phonegap • #phonegap on http://irc.freenode.net
  • 29. Tooling / Automation • phonegap-dev • ./droidscript • ibug
  • 30.
  • 31. XUI A micro tiny JavaScript Framework
  • 33. Some Reasons • Small screens • Limited CPU • Limited RAM • Limited storage • Sketch connectivity
  • 34. Consider • jQuery 40+ kb • Dojo 25+ kb • YUI/MooTools/Etc same difference
  • 35. Good Times for WebKit • Apple iPhone OS • Google Android OS • Palm webOS http://quirksmode.org/m/table.html
  • 36. Then, We Gave Up • Windows Mobile is IE4 or 6/7 • Nokia Symbian is an early WebKit • RIM Blackberry is an unholy mess
  • 38. XUI Was Born (2008) • Between 2 and 3 kb • DOM concerns only • Chainable syntax (it was trendy) • Conditional builds over conditional code
  • 39. XUI is NOT a set of GUI controls or widgets.
  • 40. Selectors // basic matches by selector x$('div.foo'); x$('ul#global-nav li.selected'); // element literals x$(window); x$(document); // lists of elements x$('li', 'div'); // arrays even x$(['div#foo', 'div.bar']);
  • 41. Chaining // method chaining x$('ul#nav li a:first').html('hey there').css({color:'blue'});
  • 42. Helpful Stuff // helpful DOM node filtering x$('ul li').has('ul li.selected'); x$('ul li').not('ul li.selected'); // classic iteration x$('.book').each(function() { ... });
  • 43. DOM Manipulation // DOM manipulation basics x$('#protection').html( '<strong>for hard wood</strong>' ); // other hacky ways to hack around x$('#title').html( 'after', '<p>B.Sc</p>' ); // implicit node creation x$("<p id='foo'></p>").html('bar'); // <p id="foo">bar</p> // inner, outer, top, bottom, before, after x$('#shortcuts').bottom('make life so easy!') // guess what this does? x$('#iehack').remove(); // getter var aboutUrl = x$('a.about').attr('href'); // setter x$('a.mysite').attr('href','http://westcoastlogic.com');
  • 44. Styles and CSS // Manipulate style // // dangerously set style properties x$('a.fugly').css({color:'blue'}); // probably better x$('#basic').addClass('selected'); // nice conditional callback syntax x$('#feet').hasClass('smelly', function(){ x$(this).removeClass('stinky'); });
  • 45. Eventing • click <--bad! • load <--questionable! • touchstart, touchmove, touchend, touchcancel • guesturestart, guesturechange, guestureend • orientationchange • deviceready
  • 46. Special Effects // basic animation support by way of Emile x$('#fx').tween({background:'red', duration:1.5 });
  • 47. Alternatives • Develop for Palm exclusively • jQtouch • Dashcode <-- Ugh! No!! • Scroll Touch by Uxebu
  • 48. Emerging Techniques • Single page apps via index.html • Lazy eval JavaScript • Conditional builds for JavaScript logic
  • 51. Going Offline • Web apps: Cache Manifest • Hybrid apps: Reachability API
  • 52. Once You Are Offline • Cookies • DOM storage • SQLite • Other hacks: flash, window.name, etc.
  • 53. Ghetto, Actually • DOM Storage is key/value only; Slightly nicer than cookies but way lamer name • SQLite seems like a bad idea: schemas, migrations, impedance mismatch, oh my
  • 54. Lawnchair Quickly • JSON document store (not key/value) • Designed for mobile; very light • Clean and simple async oo API • Adaptor pattern for store customization
  • 55. Pull up a Lawnchair! var people = new Lawnchair({adaptor:'dom'});
  • 56. Adding Records // Saving a document var me = {name:'brian'}; people.save(me); // Saving a document async people.save({name:'frank'}, function(r) {     console.log(r); }); // Specifying your own key people.save({key:'whatever', name:'dracula'});
  • 57. Finding Records // Get that document people.get(me.key, function(r){     console.log(r); }); // Returns all documents as an array to a callback people.all(function(r){     console.log(r); }); // List all with shortcut syntax people.all('console.log(r)');
  • 58. Removing Records // Remove a document directly people.get(me.key, function(r){     people.remove(me); }); // Remove a document by key people.save({key:'die', name:'duder'}); people.remove('die'); // Destroy all documents people.nuke();
  • 59. Helpful Stuff // Classic iteration people.each(function(r){     console.log(r); }); // Classic with terse shorthand syntax people.each('console.log(r)');
  • 60. Searching / Finding // Iterate documents conditionally! // The first function is a conditional. // The second is a callback exec on records returned by the first people.find(     function(r) {return r.name == brian},     function(r) {console.log(r)} ); // Iterate conditionally via shorthand people.find('r.name == "brian"', 'console.log(r)'); // You can mix and match shorthand btw people.find('r.name == "brian"', function(r){     console.log(r) });
  • 61. Thanks! Time for a coffee?
  • 62. Q &A

Editor's Notes