SlideShare a Scribd company logo
1 of 44
Download to read offline
EmpireJS 2012
Mobile Apps: Finding the balance between
       performance and flexibility


         Tom Germeau - @tomg
            chartbeat.com
Hi. I’m Tom.
I DESIGN & ENGINEER AT CHARTBEAT
Joost
              2007 - 2009

 STANDALONE JS/SVG BASED VIDEO PLAYER
SAME CHALLENGE AS TODAY: KEEP UI SNAPPY
Chartbeat
REALTIME ANALYTICS. JS EVERYWHERE. DEMO!
The goal
A BETTER MOBILE DASHBOARD
to do
Coming up ...
     Our constraints
  Choosing a framework
     Making it work
  Layers & performance
     Other Web tech
5 weeks
   FROM MOCKUPS TO APPSTORE.
BUT HAVE OTHER PLATFORMS IN MIND.
JS+Python Shop
AND WE WANT TO KEEP THINGS SIMPLE
HTML5/JS is so 2011
 AT LEAST THAT’S WHAT ZUCKERBERG SAID




      * Our Biggest Mistake Was Betting Too Much On HTML5
WHAT HE ACTUALLY MEANT ...
The tool didn’t fit the job anymore
    A CHANGE IN REQUIREMENTS MADE
     AN HTML ONLY APP INSUFFICIENT
Full native App
 UNKNOWN & TOO ADVANCED
     DIDN’T FIT THE JOB
Cordova
ONE BLANK WEBVIEW.
 DIDN’T FIT THE JOB.
Cocoa Touch
 EASILY HANDLE ADVANCED
 GESTURES AND NAVIGATION
HTML & JS
FORMATTING AND STYLING
SCRIPTING INTERACTIONS
HTML & JS
DUH. REUSE LARGE AMOUNTS OF CODE/ASSETS
           ON OTHER PLATFORMS
Thin native wrapper
 THE SWEET SPOT: SCRIPTABLE VIEWDECK
       WITH MULTIPLE WEBVIEWS
Implementation
  WE PICKED A PLATFORM
     LET’S BUILD ON IT
Native Stack

      ViewDeck (open source)

*
    NavigationController (cocoa)


*        UIWebView (cocoa)
Closure Compiler
      SANITY CHECK CODE &
 PROVIDES SIMPLE MODULE SYSTEM
App startup

                       UIWebView

                       /mobile/dashboard.html
                       /js/v123-app.js
                       new chartbeat.Dashboard()

                                       dashboard ready
UIWebView              UIWebView                   UIWebView

/mobile/menu.html      /mobile/page.html           /mobile/traffic.html
/js/v123-app.js        /js/v123-app.js             /js/v123-app.js
new chartbeat.Menu()   new chartbeat.Page()        new chartbeat.Traffic()
Scripting the wrapper
   CONFIGURING AND NAVIGATING
        WEBVIEWS FROM JS
Scripting the wrapper
 chartbeat.mobile.exec('navigate', {
   'target': 'left',
   'url': '../menu/#state=loggedin’
 });
 // communicate using hashchangeevents
Managing rendering
   REALTIME DATA MAKES OUR
   DOM CHANGE CONSTANTLY
One big Layer
HA-BROWSERS WILL DIVIDE YOUR PAGE
     IN ARBITRARY SQUARE TILES
Layers
div {
  transform: translateZ(0);
  /* move div to own compositing layer
   * to hint heavily updated areas
   */
}
Layers
 UPDATE ASPECTS OF YOUR COMPOSITION
WITHOUT RUNNING LAYOUT AND RENDERERS
Layers
WATCH OUT FOR UNWANTED MODE SWITCHES

          ANIMATED OPACITY,
      ADDING/REMOVING STYLES, ...
Filters
div {
  filter: hue-rotate(120deg);
  /* move div to own compositing layer */
  /* not a lot of support yet */
}
Zen of Performance
MINIMUM LAYER COUNT VS MINIMUM REDRAWS
Zen of Performance
 MORE MEMORY, SMOOTHER EXPERIENCE,
  EASIER TO CODE UNTIL YOU RUN OUT
Native Scroll
-webkit-overflow-scrolling: touch;
/* iOS5+ */
/* <iOS4 fall back to Scrollability */
SVG/CSS vs Canvas
       OR HOW WE BUILT
   A BATTERY FRIENDLY GAUGE
SVG/CSS vs Canvas


 ONE DRAW. TONS OF REDRAWS. DEMO!
SVG/CSS vs Canvas
 background:         radial-gradient(...);
 mask:               url(gauge.svg);
 transform-origin:   center center;
 transform:          rotate(-124deg);
 transition:         all 1.5s ease

 /* does not trigger redraw on animation */
App lifecycle
APPS DON’T REALLY (ALWAYS) QUIT
Cheap SSL Login
  JUST CREDENTIALS OVER CORS
Avoid getting ‘jetsammed’
HANDLE IOS MEMORY PRESSURE NOTIFICATIONS
Avoid getting ‘jetsammed’
  BE ABLE TO CON/DESTRUCT YOUR VIEW
    FROM YOUR MODEL AT ALL TIMES
DevTools & Simulator
  // iOS5 - Chromium 12
  [WebView _enableRemoteInspector]

  // iOS6 - Safari 6
  // works out of the box!!
Thank you
Chartbeat.com/jobs

     @tomg
Credits
https://developers.google.com/closure/compiler/

http://nerds.airbnb.com/box-shadows-are-expensive-to-paint

http://www.chromium.org/developers/design-documents/gpu-
accelerated-compositing-in-chrome

http://www.html5rocks.com/en/tutorials/filters/understanding-css/

http://joehewitt.com/2011/10/05/fast-animation-with-ios-webkit

http://atnan.com/blog/2011/11/17/enabling-remote-debugging-via-
private-apis-in-mobile-safari/

http://joehewitt.com/2011/10/05/fast-animation-with-ios-webkit

More Related Content

What's hot

Minko - Windows App Meetup Nov. 2013
Minko - Windows App Meetup Nov. 2013Minko - Windows App Meetup Nov. 2013
Minko - Windows App Meetup Nov. 2013
Minko3D
 

What's hot (18)

VueJS: The Simple Revolution
VueJS: The Simple RevolutionVueJS: The Simple Revolution
VueJS: The Simple Revolution
 
Gaikan
GaikanGaikan
Gaikan
 
Rebranding an ios application
Rebranding an ios applicationRebranding an ios application
Rebranding an ios application
 
Magnolia & Angular JS - an Approach for Javascript RIAs Delivered by a CMS
Magnolia & Angular JS - an Approach for Javascript RIAs Delivered by a CMSMagnolia & Angular JS - an Approach for Javascript RIAs Delivered by a CMS
Magnolia & Angular JS - an Approach for Javascript RIAs Delivered by a CMS
 
Android jetpack compose | Declarative UI
Android jetpack compose | Declarative UI Android jetpack compose | Declarative UI
Android jetpack compose | Declarative UI
 
WordPress 2017 with VueJS and GraphQL
WordPress 2017 with VueJS and GraphQLWordPress 2017 with VueJS and GraphQL
WordPress 2017 with VueJS and GraphQL
 
Event Bus: Android Simplificado
Event Bus: Android SimplificadoEvent Bus: Android Simplificado
Event Bus: Android Simplificado
 
Build 2017 - B8100 - What's new and coming for Windows UI: XAML and composition
Build 2017 - B8100 - What's new and coming for Windows UI: XAML and compositionBuild 2017 - B8100 - What's new and coming for Windows UI: XAML and composition
Build 2017 - B8100 - What's new and coming for Windows UI: XAML and composition
 
Minko - Windows App Meetup Nov. 2013
Minko - Windows App Meetup Nov. 2013Minko - Windows App Meetup Nov. 2013
Minko - Windows App Meetup Nov. 2013
 
Introduction to Flex Hero for Mobile Devices
Introduction to Flex Hero for Mobile DevicesIntroduction to Flex Hero for Mobile Devices
Introduction to Flex Hero for Mobile Devices
 
AngularJS preso with directives and route resolve
AngularJS preso with directives and route resolveAngularJS preso with directives and route resolve
AngularJS preso with directives and route resolve
 
The Art of AngularJS - DeRailed 2014
The Art of AngularJS - DeRailed 2014The Art of AngularJS - DeRailed 2014
The Art of AngularJS - DeRailed 2014
 
Mastering the Master Detail Pattern
Mastering the Master Detail PatternMastering the Master Detail Pattern
Mastering the Master Detail Pattern
 
Using Magnolia in a Microservices Architecture
Using Magnolia in a Microservices ArchitectureUsing Magnolia in a Microservices Architecture
Using Magnolia in a Microservices Architecture
 
Réaliser un jeu cross plateformes avec WebGL et babylon.js
Réaliser un jeu cross plateformes avec WebGL et babylon.jsRéaliser un jeu cross plateformes avec WebGL et babylon.js
Réaliser un jeu cross plateformes avec WebGL et babylon.js
 
Jetpack compose
Jetpack composeJetpack compose
Jetpack compose
 
Jetpack Compose - Android’s modern toolkit for building native UI
Jetpack Compose - Android’s modern toolkit for building native UIJetpack Compose - Android’s modern toolkit for building native UI
Jetpack Compose - Android’s modern toolkit for building native UI
 
Try Jetpack Compose
Try Jetpack ComposeTry Jetpack Compose
Try Jetpack Compose
 

Similar to Tom Germeau: Mobile Apps: Finding the balance between performance and flexibility

Functional Web Development
Functional Web DevelopmentFunctional Web Development
Functional Web Development
FITC
 
Web app and more
Web app and moreWeb app and more
Web app and more
faming su
 
Isomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master ClassIsomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master Class
Spike Brehm
 

Similar to Tom Germeau: Mobile Apps: Finding the balance between performance and flexibility (20)

HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias WessendorfHTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
 
Top Ten Tips for HTML5/Mobile Web Development
Top Ten Tips for HTML5/Mobile Web DevelopmentTop Ten Tips for HTML5/Mobile Web Development
Top Ten Tips for HTML5/Mobile Web Development
 
Javaland 2014 / GWT architectures and lessons learned
Javaland 2014 / GWT architectures and lessons learnedJavaland 2014 / GWT architectures and lessons learned
Javaland 2014 / GWT architectures and lessons learned
 
Front-end. Global domination
Front-end. Global dominationFront-end. Global domination
Front-end. Global domination
 
Frontend. Global domination.
Frontend. Global domination.Frontend. Global domination.
Frontend. Global domination.
 
Functional Web Development
Functional Web DevelopmentFunctional Web Development
Functional Web Development
 
App innovationcircles xamarin
App innovationcircles xamarinApp innovationcircles xamarin
App innovationcircles xamarin
 
Cross platform mobile app development with Xamarin
Cross platform mobile app development with XamarinCross platform mobile app development with Xamarin
Cross platform mobile app development with Xamarin
 
Web Apps and more
Web Apps and moreWeb Apps and more
Web Apps and more
 
Web app and more
Web app and moreWeb app and more
Web app and more
 
Introducing Sudz-C
Introducing Sudz-CIntroducing Sudz-C
Introducing Sudz-C
 
Meteoro de pegasuus! Desenvolvendo aplicações realtime com MeteorJS
Meteoro de pegasuus! Desenvolvendo aplicações realtime com MeteorJSMeteoro de pegasuus! Desenvolvendo aplicações realtime com MeteorJS
Meteoro de pegasuus! Desenvolvendo aplicações realtime com MeteorJS
 
Fake it 'til you make it
Fake it 'til you make itFake it 'til you make it
Fake it 'til you make it
 
GWT Architectures and Lessons Learned (WJAX 2013)
GWT Architectures and Lessons Learned (WJAX 2013)GWT Architectures and Lessons Learned (WJAX 2013)
GWT Architectures and Lessons Learned (WJAX 2013)
 
[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova
[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova
[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova
 
The Gist of React Native
The Gist of React NativeThe Gist of React Native
The Gist of React Native
 
React Native for ReactJS Devs
React Native for ReactJS DevsReact Native for ReactJS Devs
React Native for ReactJS Devs
 
Isomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master ClassIsomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master Class
 
Plattformübergreifende App-Entwicklung (ein Vergleich) - MobileTechCon 2010
Plattformübergreifende App-Entwicklung (ein Vergleich) - MobileTechCon 2010Plattformübergreifende App-Entwicklung (ein Vergleich) - MobileTechCon 2010
Plattformübergreifende App-Entwicklung (ein Vergleich) - MobileTechCon 2010
 
Angular js mobile jsday 2014 - Verona 14 may
Angular js mobile   jsday 2014 - Verona 14 mayAngular js mobile   jsday 2014 - Verona 14 may
Angular js mobile jsday 2014 - Verona 14 may
 

More from Chartbeat

More from Chartbeat (12)

Chartbeat: Discovery & Engagement in a Mobile-first World
Chartbeat: Discovery & Engagement in a Mobile-first WorldChartbeat: Discovery & Engagement in a Mobile-first World
Chartbeat: Discovery & Engagement in a Mobile-first World
 
Audience Building in the Age of Platforms
Audience Building in the Age of PlatformsAudience Building in the Age of Platforms
Audience Building in the Age of Platforms
 
Data in the Newsroom: Content Solutions for Advertising Challenges
Data in the Newsroom: Content Solutions for Advertising ChallengesData in the Newsroom: Content Solutions for Advertising Challenges
Data in the Newsroom: Content Solutions for Advertising Challenges
 
ONA 2015 – Can You Have Their Attention Please?
ONA 2015 – Can You Have Their Attention Please?ONA 2015 – Can You Have Their Attention Please?
ONA 2015 – Can You Have Their Attention Please?
 
Insights from Around the World
Insights from Around the WorldInsights from Around the World
Insights from Around the World
 
A Data State of the Union: Can We Make Quality Pay Online?
A Data State of the Union: Can We Make Quality Pay Online?A Data State of the Union: Can We Make Quality Pay Online?
A Data State of the Union: Can We Make Quality Pay Online?
 
Tuning TCP and NGINX on EC2
Tuning TCP and NGINX on EC2Tuning TCP and NGINX on EC2
Tuning TCP and NGINX on EC2
 
Understanding Your Traffic Sources
Understanding Your Traffic Sources Understanding Your Traffic Sources
Understanding Your Traffic Sources
 
An Introduction to Video Analytics
An Introduction to Video Analytics An Introduction to Video Analytics
An Introduction to Video Analytics
 
Top Trends in Online Journalism for 2014
Top Trends in Online Journalism for 2014Top Trends in Online Journalism for 2014
Top Trends in Online Journalism for 2014
 
Say Hello to the New Chartbeat Publishing
Say Hello to the New Chartbeat Publishing Say Hello to the New Chartbeat Publishing
Say Hello to the New Chartbeat Publishing
 
Building a Loyal and Returning Audience with the New Chartbeat Publishing
Building a Loyal and Returning Audience with the New Chartbeat PublishingBuilding a Loyal and Returning Audience with the New Chartbeat Publishing
Building a Loyal and Returning Audience with the New Chartbeat Publishing
 

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech 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
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
[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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
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
 
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...
 
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...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
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
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
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
 
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
 
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
 

Tom Germeau: Mobile Apps: Finding the balance between performance and flexibility