SlideShare uma empresa Scribd logo
1 de 20
Getting the Native Feel
 JavaScript for Mobile and Tablet HTML5 Apps



                      Bill Fisher
                   @fisherwebdev
               bill.hotstudiodev.com
overview
• HTML5 Apps vs. Native Apps
• Touchy: a jQuery plugin for touch events
• Get accelerated: js optimization + css
  animations
• Further considerations
iLose
• expensive to build for multiple platforms
• app store fees and rules
• loss of control over customer data
• no control over distribution channel and
  promotion/marketing issues
Financial Times
• Built by Assanka. Raises the bar.
• Use of HTML5 technologies and hacks to achieve
  an optimal user experience
• User promptedlocalsave to homescreen and to
  allow 50mb of
                 to
                     storage
• Last week: Financial Times kicked out of App Store
• Presentation on how they built it: http://
  vimeo.com/26604635
Hot Studio
• Recent work has been geared toward
  mobile or tablet
• Application frameworks like Sencha Touch
  or jQuery Mobile are too heavy-handed
• Need good control over the touch
  “environment”
touch event libraries

• touchscroll.js
• iscroll-4
• JSGestureRecognizer
• touchy - github.com/HotStudio/touchy
touchy: a jQuery plugin
• layered on top of ontouchstart, ontouchmove and
  ontouchend
• loosely based on native iOS gesture recognizers:
  drag, swipe, pinch, rotate, longpress
• architecture based on Ben Alman’s jQuery special
  events article
• event handlers receive the “phase” of the event in
  a parameter, in addition to other data
using touchy
Example #1
var handleTouchyPinch = function (e, $target, data) {
   $target.css('webkitTransform','scale(' + data.scale + ',' + data.scale + ')');
};
$('#my_div').bind('touchy-pinch', handleTouchyPinch);



Example #2
var degrees = 0,
   handleTouchyRotate = function (e, phase, $target, data) {

    if (phase === 'move') {

    
     degrees += data.degreeDelta;

    
     $target.css('webkitTransform','rotate3d(0,0,0,'+ degrees +'deg)');

    }
};
$('#my_div').bind('touchy-rotate', handleTouchyRotate);
event handlers: use css3

• Use 3D CSS for hardware acceleration
• *-transform: translateZ(0) or translate3d(0,0,0)

    hardware acceleration debugging:
    $ CA_COLOR_OPAQUE=1 /Developer/Platforms/iPhoneSimulator.platform/
    Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone
    Simulator
event handlers: javascript
• throttled frame rates
• name anonymous functions so they may be
  profiled
• separate reading and modifying of DOM values
  into two distinct phases of operation
things to avoid

• DOM manipulation: hit the DOM once
• accidental browser layout reflow
• animated css shadows and gradients
example uses of js + css3

 • HTML5 Rocks
 • http://desandro.com/
 • Touchy examples
further considerations
• base64 encoded images
• requestAnimationFrame
• offline use: save to homescreen + cache
  manifest + local storage
• W3C widgets
FTW
• build and advocate for optimized HTML5 apps
• create and contribute to open source projects
  that make development easier
• dream big and push the limits!
• open systems will win
Links: HTML5 Apps
HTML5 Apps vs. Native Apps
http://www.readwriteweb.com/mobile/2011/08/android-users-prefer-native-ov.php
http://www.mobiletech.mobi/blog/mobile-web-vs-native-apps-revisited/11672/
http://www.readwriteweb.com/archives/mobile_app_or_browser-based_site.php
http://www.readwriteweb.com/archives/web_vs_native_mobile_app_forrester_says_do_both.php


Financial Times HTML5 App
http://vimeo.com/26604635
http://www.ft.com/
Links: Touch
Touch Events and Touchy jQuery Plugin
https://github.com/HotStudio/touchy
https://github.com/davidaurelio/TouchScroll
https://github.com/mud/jsgesturerecognizer
https://github.com/cubiq/iscroll

developer.apple.com:
http://developer.apple.com/library/safari/#documentation/appleapplications/reference/safariwebcontent/HandlingEvents/HandlingEvents.html
http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/TouchEventClassReference/
http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/GestureEventClassReference/
Links: CSS3 and Perf
CSS3 Transforms and Animations
http://www.webkit.org/blog/386/3d-transforms/
http://desandro.github.com/3dtransforms/
http://www.html5rocks.com/en/tutorials/3d/css/
http://www.joelambert.co.uk/cssa/


Browser Optimization
http://paulirish.com/2011/dom-html5-css3-performance/
http://www.html5rocks.com/en/tutorials/speed/html5/
http://mir.aculo.us/2011/02/08/visualizing-webkits-hardware-acceleration/
http://calendar.perfplanet.com/2009/rendering-repaint-reflow-relayout-restyle/
http://www.slideshare.net/madrobby/extreme-javascript-performance
Thanks!
bill.hotstudiodev.com

Mais conteúdo relacionado

Mais procurados

Native Device vs. Mobile Web Applications
Native Device vs. Mobile Web ApplicationsNative Device vs. Mobile Web Applications
Native Device vs. Mobile Web ApplicationsTim Wright
 
Cinematic Interactives with Animate CC
Cinematic Interactives with Animate CCCinematic Interactives with Animate CC
Cinematic Interactives with Animate CCJoseph Labrecque
 
Cross Platform Mobile Development
Cross Platform Mobile DevelopmentCross Platform Mobile Development
Cross Platform Mobile DevelopmentManesh Lad
 
Appurify - Runtime Debugging, Performance Optimization and Automated CI
Appurify - Runtime Debugging, Performance Optimization and Automated CIAppurify - Runtime Debugging, Performance Optimization and Automated CI
Appurify - Runtime Debugging, Performance Optimization and Automated CIManish Lachwani
 
CC 2015 Single Page Applications for the ASPNET Developer
CC 2015   Single Page Applications for the ASPNET DeveloperCC 2015   Single Page Applications for the ASPNET Developer
CC 2015 Single Page Applications for the ASPNET DeveloperAllen Conway
 
Thinking in Components
Thinking in ComponentsThinking in Components
Thinking in ComponentsFITC
 
Marionette structure with modules
Marionette structure with modulesMarionette structure with modules
Marionette structure with modulesmatt-briggs
 
CA Plex on Apple Mac, iOS, Android
CA Plex on Apple Mac, iOS, AndroidCA Plex on Apple Mac, iOS, Android
CA Plex on Apple Mac, iOS, AndroidCM First Group
 
Mobilizing Your Visualforce Application With JQuery and KnockoutJS
Mobilizing Your Visualforce Application With JQuery and KnockoutJSMobilizing Your Visualforce Application With JQuery and KnockoutJS
Mobilizing Your Visualforce Application With JQuery and KnockoutJSSalesforce Developers
 

Mais procurados (13)

Practical html5
Practical html5Practical html5
Practical html5
 
Native Device vs. Mobile Web Applications
Native Device vs. Mobile Web ApplicationsNative Device vs. Mobile Web Applications
Native Device vs. Mobile Web Applications
 
2014 Picking a Platform by Anand Kulkarni
2014 Picking a Platform by Anand Kulkarni2014 Picking a Platform by Anand Kulkarni
2014 Picking a Platform by Anand Kulkarni
 
Cinematic Interactives with Animate CC
Cinematic Interactives with Animate CCCinematic Interactives with Animate CC
Cinematic Interactives with Animate CC
 
Cross Platform Mobile Development
Cross Platform Mobile DevelopmentCross Platform Mobile Development
Cross Platform Mobile Development
 
Appurify - Runtime Debugging, Performance Optimization and Automated CI
Appurify - Runtime Debugging, Performance Optimization and Automated CIAppurify - Runtime Debugging, Performance Optimization and Automated CI
Appurify - Runtime Debugging, Performance Optimization and Automated CI
 
CC 2015 Single Page Applications for the ASPNET Developer
CC 2015   Single Page Applications for the ASPNET DeveloperCC 2015   Single Page Applications for the ASPNET Developer
CC 2015 Single Page Applications for the ASPNET Developer
 
Thinking in Components
Thinking in ComponentsThinking in Components
Thinking in Components
 
Marionette structure with modules
Marionette structure with modulesMarionette structure with modules
Marionette structure with modules
 
CA Plex on Apple Mac, iOS, Android
CA Plex on Apple Mac, iOS, AndroidCA Plex on Apple Mac, iOS, Android
CA Plex on Apple Mac, iOS, Android
 
Mobilizing Your Visualforce Application With JQuery and KnockoutJS
Mobilizing Your Visualforce Application With JQuery and KnockoutJSMobilizing Your Visualforce Application With JQuery and KnockoutJS
Mobilizing Your Visualforce Application With JQuery and KnockoutJS
 
Progressive Web Apps are here!
Progressive Web Apps are here!Progressive Web Apps are here!
Progressive Web Apps are here!
 
Jquery
JqueryJquery
Jquery
 

Semelhante a Getting the-native-feel

Mobile web or native app
Mobile web or native appMobile web or native app
Mobile web or native appMike Takahashi
 
Mobile App Development
Mobile App DevelopmentMobile App Development
Mobile App DevelopmentChris Morrell
 
Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011Nuxeo
 
Win j svsphonegap-damyan-petev-mihail-mateev
Win j svsphonegap-damyan-petev-mihail-mateevWin j svsphonegap-damyan-petev-mihail-mateev
Win j svsphonegap-damyan-petev-mihail-mateevMihail Mateev
 
Responsive websites. Toolbox
Responsive websites. ToolboxResponsive websites. Toolbox
Responsive websites. ToolboxWojtek Zając
 
Desarrollo de apps multiplataforma con tecnologías web
Desarrollo de apps multiplataforma con tecnologías webDesarrollo de apps multiplataforma con tecnologías web
Desarrollo de apps multiplataforma con tecnologías webSoftware Guru
 
Sg conference multiplatform_apps_adam_stanley
Sg conference multiplatform_apps_adam_stanleySg conference multiplatform_apps_adam_stanley
Sg conference multiplatform_apps_adam_stanleyn_adam_stanley
 
Web app with j query & javascript (5:4)
Web app with j query & javascript (5:4)Web app with j query & javascript (5:4)
Web app with j query & javascript (5:4)Thinkful
 
Html5 today
Html5 todayHtml5 today
Html5 todayRoy Yu
 
JavaScript for ASP.NET programmers (webcast) upload
JavaScript for ASP.NET programmers (webcast) uploadJavaScript for ASP.NET programmers (webcast) upload
JavaScript for ASP.NET programmers (webcast) uploadRuss Fustino
 
The Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devicesThe Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devicesWesley Hales
 
Things I've learnt from my Hacker News web app
Things I've learnt from my Hacker News web appThings I've learnt from my Hacker News web app
Things I've learnt from my Hacker News web appLim Chee Aun
 
Responsive Web Design - Tom Robertshaw
Responsive Web Design - Tom RobertshawResponsive Web Design - Tom Robertshaw
Responsive Web Design - Tom RobertshawMeet Magento Spain
 
The XPages Mobile Controls: What's New in Notes 9.0.1
The XPages Mobile Controls: What's New in Notes 9.0.1The XPages Mobile Controls: What's New in Notes 9.0.1
The XPages Mobile Controls: What's New in Notes 9.0.1Teamstudio
 
Mobile Hybrid Development with WordPress
Mobile Hybrid Development with WordPressMobile Hybrid Development with WordPress
Mobile Hybrid Development with WordPressDanilo Ercoli
 
GeneralMobile Hybrid Development with WordPress
GeneralMobile Hybrid Development with WordPressGeneralMobile Hybrid Development with WordPress
GeneralMobile Hybrid Development with WordPressGGDBologna
 
John Resig Beijing 2010 (English Version)
John Resig Beijing 2010 (English Version)John Resig Beijing 2010 (English Version)
John Resig Beijing 2010 (English Version)Jia Mi
 

Semelhante a Getting the-native-feel (20)

Mobile web or native app
Mobile web or native appMobile web or native app
Mobile web or native app
 
Mobile App Development
Mobile App DevelopmentMobile App Development
Mobile App Development
 
Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011
 
Win j svsphonegap-damyan-petev-mihail-mateev
Win j svsphonegap-damyan-petev-mihail-mateevWin j svsphonegap-damyan-petev-mihail-mateev
Win j svsphonegap-damyan-petev-mihail-mateev
 
Responsive websites. Toolbox
Responsive websites. ToolboxResponsive websites. Toolbox
Responsive websites. Toolbox
 
Desarrollo de apps multiplataforma con tecnologías web
Desarrollo de apps multiplataforma con tecnologías webDesarrollo de apps multiplataforma con tecnologías web
Desarrollo de apps multiplataforma con tecnologías web
 
Sg conference multiplatform_apps_adam_stanley
Sg conference multiplatform_apps_adam_stanleySg conference multiplatform_apps_adam_stanley
Sg conference multiplatform_apps_adam_stanley
 
Web app with j query & javascript (5:4)
Web app with j query & javascript (5:4)Web app with j query & javascript (5:4)
Web app with j query & javascript (5:4)
 
AppNotch
AppNotchAppNotch
AppNotch
 
Html5 today
Html5 todayHtml5 today
Html5 today
 
JavaScript for ASP.NET programmers (webcast) upload
JavaScript for ASP.NET programmers (webcast) uploadJavaScript for ASP.NET programmers (webcast) upload
JavaScript for ASP.NET programmers (webcast) upload
 
The Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devicesThe Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devices
 
Things I've learnt from my Hacker News web app
Things I've learnt from my Hacker News web appThings I've learnt from my Hacker News web app
Things I've learnt from my Hacker News web app
 
Responsive Web Design - Tom Robertshaw
Responsive Web Design - Tom RobertshawResponsive Web Design - Tom Robertshaw
Responsive Web Design - Tom Robertshaw
 
The XPages Mobile Controls: What's New in Notes 9.0.1
The XPages Mobile Controls: What's New in Notes 9.0.1The XPages Mobile Controls: What's New in Notes 9.0.1
The XPages Mobile Controls: What's New in Notes 9.0.1
 
Mobile Hybrid Development with WordPress
Mobile Hybrid Development with WordPressMobile Hybrid Development with WordPress
Mobile Hybrid Development with WordPress
 
GeneralMobile Hybrid Development with WordPress
GeneralMobile Hybrid Development with WordPressGeneralMobile Hybrid Development with WordPress
GeneralMobile Hybrid Development with WordPress
 
DjangoSki
DjangoSkiDjangoSki
DjangoSki
 
John Resig Beijing 2010 (English Version)
John Resig Beijing 2010 (English Version)John Resig Beijing 2010 (English Version)
John Resig Beijing 2010 (English Version)
 
Future of Mobile
Future of MobileFuture of Mobile
Future of Mobile
 

Último

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
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 DevelopmentsTrustArc
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
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
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
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 StreamsRoshan Dwivedi
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
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 productivityPrincipled Technologies
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
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
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
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
 

Último (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
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
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
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
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
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
 

Getting the-native-feel

  • 1. Getting the Native Feel JavaScript for Mobile and Tablet HTML5 Apps Bill Fisher @fisherwebdev bill.hotstudiodev.com
  • 2. overview • HTML5 Apps vs. Native Apps • Touchy: a jQuery plugin for touch events • Get accelerated: js optimization + css animations • Further considerations
  • 3. iLose • expensive to build for multiple platforms • app store fees and rules • loss of control over customer data • no control over distribution channel and promotion/marketing issues
  • 4.
  • 5.
  • 6. Financial Times • Built by Assanka. Raises the bar. • Use of HTML5 technologies and hacks to achieve an optimal user experience • User promptedlocalsave to homescreen and to allow 50mb of to storage • Last week: Financial Times kicked out of App Store • Presentation on how they built it: http:// vimeo.com/26604635
  • 7. Hot Studio • Recent work has been geared toward mobile or tablet • Application frameworks like Sencha Touch or jQuery Mobile are too heavy-handed • Need good control over the touch “environment”
  • 8. touch event libraries • touchscroll.js • iscroll-4 • JSGestureRecognizer • touchy - github.com/HotStudio/touchy
  • 9. touchy: a jQuery plugin • layered on top of ontouchstart, ontouchmove and ontouchend • loosely based on native iOS gesture recognizers: drag, swipe, pinch, rotate, longpress • architecture based on Ben Alman’s jQuery special events article • event handlers receive the “phase” of the event in a parameter, in addition to other data
  • 10. using touchy Example #1 var handleTouchyPinch = function (e, $target, data) { $target.css('webkitTransform','scale(' + data.scale + ',' + data.scale + ')'); }; $('#my_div').bind('touchy-pinch', handleTouchyPinch); Example #2 var degrees = 0, handleTouchyRotate = function (e, phase, $target, data) { if (phase === 'move') { degrees += data.degreeDelta; $target.css('webkitTransform','rotate3d(0,0,0,'+ degrees +'deg)'); } }; $('#my_div').bind('touchy-rotate', handleTouchyRotate);
  • 11. event handlers: use css3 • Use 3D CSS for hardware acceleration • *-transform: translateZ(0) or translate3d(0,0,0) hardware acceleration debugging: $ CA_COLOR_OPAQUE=1 /Developer/Platforms/iPhoneSimulator.platform/ Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator
  • 12. event handlers: javascript • throttled frame rates • name anonymous functions so they may be profiled • separate reading and modifying of DOM values into two distinct phases of operation
  • 13. things to avoid • DOM manipulation: hit the DOM once • accidental browser layout reflow • animated css shadows and gradients
  • 14. example uses of js + css3 • HTML5 Rocks • http://desandro.com/ • Touchy examples
  • 15. further considerations • base64 encoded images • requestAnimationFrame • offline use: save to homescreen + cache manifest + local storage • W3C widgets
  • 16. FTW • build and advocate for optimized HTML5 apps • create and contribute to open source projects that make development easier • dream big and push the limits! • open systems will win
  • 17. Links: HTML5 Apps HTML5 Apps vs. Native Apps http://www.readwriteweb.com/mobile/2011/08/android-users-prefer-native-ov.php http://www.mobiletech.mobi/blog/mobile-web-vs-native-apps-revisited/11672/ http://www.readwriteweb.com/archives/mobile_app_or_browser-based_site.php http://www.readwriteweb.com/archives/web_vs_native_mobile_app_forrester_says_do_both.php Financial Times HTML5 App http://vimeo.com/26604635 http://www.ft.com/
  • 18. Links: Touch Touch Events and Touchy jQuery Plugin https://github.com/HotStudio/touchy https://github.com/davidaurelio/TouchScroll https://github.com/mud/jsgesturerecognizer https://github.com/cubiq/iscroll developer.apple.com: http://developer.apple.com/library/safari/#documentation/appleapplications/reference/safariwebcontent/HandlingEvents/HandlingEvents.html http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/TouchEventClassReference/ http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/GestureEventClassReference/
  • 19. Links: CSS3 and Perf CSS3 Transforms and Animations http://www.webkit.org/blog/386/3d-transforms/ http://desandro.github.com/3dtransforms/ http://www.html5rocks.com/en/tutorials/3d/css/ http://www.joelambert.co.uk/cssa/ Browser Optimization http://paulirish.com/2011/dom-html5-css3-performance/ http://www.html5rocks.com/en/tutorials/speed/html5/ http://mir.aculo.us/2011/02/08/visualizing-webkits-hardware-acceleration/ http://calendar.perfplanet.com/2009/rendering-repaint-reflow-relayout-restyle/ http://www.slideshare.net/madrobby/extreme-javascript-performance

Notas do Editor

  1. bill fisher, hot studio, slides in pdf at url, html5 app vs. web app \n
  2. peter-paul koch: html5 app\ntouch\ngetting the native feel in the event handlers\ni’ll briefly touch on other issues in developing html5 apps\n
  3. apple wants 30% from publishers...?\n
  4. \n
  5. \n
  6. Gives FT huge flexibility and leverage in negotiating with Apple. Do they even need Apple?\n\n
  7. Can’t talk directly about recent work, but it was an HTML5 app.\nLots of interest in mobile / tablet\nBecause touch is inherently more limited than a mouse and keyboard, the relationship between different actions can result in conflict...\n
  8. \n
  9. webkit cross browser -- mobile safari and android browser\nlink to ben alman at the end\ndata - pinch not only scale, but current center point. pinch only works in recent android.\n
  10. not necessary to maintain the lexical scope for “this” because you get $target\n\n3d transforms - next slide.\n\n
  11. more research here...\n\nold android and rotate + 3d ?\n
  12. Frame rates don’t need to be faster than 30fps, typically. definitely not more than 60fps, the refresh rate of the screen. Events fire more rapidly, so the response needs to be throttled.\nHTML5 Rocks, link at end.\n\n
  13. Manipulate DOM fragments, then plug them in.\nLots of things can trigger reflow. Any display:none, any check of offsetWidth, etc.\nCheck out Paul’s 30min video on browser optimization.\n
  14. \n
  15. lots more research...\n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n