mobile webinar yehuda 6 10

Upload: ray-horn

Post on 30-May-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    1/216

    { Mobile

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    2/216

    { Rails 3

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    3/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    4/216

    Ajax

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    5/216

    March 1999

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    6/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    7/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    8/216

    August 2001

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    9/216

    Data binding is a DHTML feature that lets you easily bindindividual elements in your document to data from another source,such as a database or comma-delimited text le. When thedocument is loaded, the data is automatically retrieved from the

    source and formatted and displayed within the element .

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    10/216

    Because data is downloaded to the client asynchronously , pagesrender quickly and provide immediate interactivity. Oncedownloaded, the data can be sorted and ltered withoutrequiring additional trips to the server

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    11/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    12/216

    Ajax

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    13/216

    Client

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    14/216

    IE4+ MadeClients a Lot

    Smarter

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    15/216

    Web 2.0Made Use of

    the Tech

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    16/216

    A DecadeLater

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    17/216

    Evolution of Client-SideCapabilities

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    18/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    19/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    20/216

    client

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    21/216

    Not New

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    22/216

    Newer thanAjax in 2005

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    23/216

    Not EnoughExplanation

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    24/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    25/216

    IE6Factor

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    26/216

    PeopleFeel

    Burned

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    27/216

    Ill look atHTML5 when I

    can use it...

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    28/216

    ...In 2019

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    29/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    30/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    31/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    32/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    33/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    34/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    35/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    36/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    37/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    38/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    39/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    40/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    41/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    42/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    43/216

    People DontUse Cell Phones

    Made in 2001

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    44/216

    +s

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    45/216

    BestDistribution

    System

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    46/216

    No ApprovalProcess

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    47/216

    InstantUpdates

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    48/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    49/216

    StartCaringNow

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    50/216

    Mobile

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    51/216

    Very Di ff erentConstraints

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    52/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    53/216

    Fast, ReliableConnections

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    54/216

    HTTP OverheadDominates

    Small Assets

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    55/216

    Hard Disks

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    56/216

    HTTPCaches Persist

    Forever

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    57/216

    LowestCommon

    Denominator?

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    58/216

    2001

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    59/216

    2006?

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    60/216

    PowerfulProcessor

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    61/216

    UnlimitedBattery

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    62/216

    Prefer NewDownload to

    Stale Data

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    63/216

    YSlow!

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    64/216

    One Large JSor CSS File

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    65/216

    }:cache => true

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    66/216

    Spriting

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    67/216

    }.fanta { background : sprite-image( "bottles/fanta.png" );}.seven-up { background : sprite-image( "bottles/seven-up.png" );}.coke { background : sprite-image( "cans/coke.png" ) no-repeat ;}

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    68/216

    Expires Header

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    69/216

    }# # We use cached-busting location names# # with the far-future expires# # headers to ensure that if a file does# # change it can force a new# # request.

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    70/216

    ETags

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    71/216

    }def show @article = Article .find(params[ :id ])fresh_when( :etag => @article ,:last_modified => @article .created_at.utc,:public => true)end

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    72/216

    25K Components

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    73/216

    Lots StillApplies

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    74/216

    Some MissingInformation

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    75/216

    MobileConstraints

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    76/216

    Poor HTTPCaching

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    77/216

    Flaky andOffl ine

    Connections

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    78/216

    LongDownloads Can

    Get Dropped

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    79/216

    LowestCommon

    Denominator?

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    80/216

    HTML5 Offl ine

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    81/216

    ApplicationCache

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    82/216

    Local Storage

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    83/216

    Prefer StaleData to a New

    Download

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    84/216

    Some PeoplePay Per kb

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    85/216

    Limited Battery,Limited CPU

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    86/216

    RevisitOrthodoxy

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    87/216

    PriorityDownload Data

    Only Once

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    88/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    89/216

    Home PageRead Story

    Back Button

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    90/216

    Home Page

    6k

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    91/216

    Read Story

    16k

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    92/216

    Home Page

    6k

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    93/216

    SlowConnections

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    94/216

    Offl ine

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    95/216

    IncrementalRendering

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    96/216

    Cache Clearedon a Dime

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    97/216

    16k?!

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    98/216

    {var sns_checked = false ;var current_tab = "blogsmith" ;function tabTo ( tab ){ document . getElementById ( 'formerrors' ).innerHTML = '' ;

    document . getElementById ( 'cmtuinfo_email' ). style . display ='none' ; document . getElementById ( 'cmtuinfo_blogsmith' ). style . display ='none' ; document . getElementById ( 'cmtuinfo_sns' ). style . display ='none' ; document . getElementById ( 'cmtuinfo_' +tab). style . display ='block' ;

    document . getElementById ( 'cmtutab_email' ). className ='' ; document . getElementById ( 'cmtutab_blogsmith' ). className ='' ; document . getElementById ( 'cmtutab_sns' ). className ='' ; document . getElementById ( 'cmtutab_' +tab). className ='currenttab' ;

    if ( ! sns_checked && tab == 'sns' ){

    image1 = new Image();image1. src = " http://www.blogsmithmedia.com/framework.weblogsinc.com/media/

    loading.gif " ;sns.init( 'ch1ga1KvP7TotwTC' );sns_checked = true ;

    }

    current_tab = tab;

    http://www.blogsmithmedia.com/framework.weblogsinc.com/media/loading.gifhttp://www.blogsmithmedia.com/framework.weblogsinc.com/media/loading.gifhttp://www.blogsmithmedia.com/framework.weblogsinc.com/media/loading.gifhttp://www.blogsmithmedia.com/framework.weblogsinc.com/media/loading.gifhttp://www.blogsmithmedia.com/framework.weblogsinc.com/media/loading.gifhttp://www.blogsmithmedia.com/framework.weblogsinc.com/media/loading.gif
  • 8/9/2019 Mobile Webinar Yehuda 6 10

    99/216

    { Your comments: Remember me E-Mail me when someone replies to this comment < input type ="hidden" name="ButtonSave" value ="Save" />

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    100/216

    Two Problems

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    101/216

    1. Boilerplate

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    102/216

    2. Structural

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    103/216

    {There are also some more technical patents for

    iChat video encoding and error adjustments ontouchscreens, as well as overall patents for theMacBook Air SuperDrive and iDVD. It seems like theUSPTO is just cleaning out Apple's old patents --most of these were filed back in 2007. Now, maybethey can set the legal patent team up on neweraccomplishments .

    Tags: apple ,

    error ,

    http://tuaw.com/tag/ipadhttp://i.tuaw.com/tag/apple/http://i.tuaw.com/tag/error/http://i.tuaw.com/tag/error/http://i.tuaw.com/tag/error/http://i.tuaw.com/tag/apple/http://i.tuaw.com/tag/apple/http://tuaw.com/tag/ipadhttp://tuaw.com/tag/ipad
  • 8/9/2019 Mobile Webinar Yehuda 6 10

    104/216

    Ideal

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    105/216

    DownloadBoilerplateHTML Once

    D l d

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    106/216

    DownloadHTML

    TemplatesOnce

    U

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    107/216

    UseLightweightTransport for

    Data

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    108/216

    Download DataProspectively

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    109/216

    App ShouldWork Without a

    Connection

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    110/216

    (with staledata)

    A Sh ld

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    111/216

    App ShouldWork WhileMaking a

    Connection

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    112/216

    (with staledata)

    Applications

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    113/216

    ApplicationsShould AvoidIncrementalRendering

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    114/216

    Arch?

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    115/216

    REST

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    116/216

    HTML==

    Static Asset

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    117/216

    Updatable, ButCaching

    Semantics

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    118/216

    Semantic HTML

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    119/216

    Native Protocol

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    120/216

    HTTP

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    121/216

    Rack

    HTTP=

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    122/216

    NativeRepresentation

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    123/216

    JSON

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    124/216

    }render :json => @article

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    125/216

    }class PostsControllerrespond_to :json def index @articles = Article .allrespond_with @articles endend

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    126/216

    Treat theBrowser Like an

    API Client

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    127/216

    Wait!

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    128/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    129/216

    Poor HTTPCaching, Right?

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    130/216

    Right!

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    131/216

    New Tools

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    132/216

    HTML5 Offl ineAPIs

    (6.6)

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    133/216

    ApplicationCache

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    134/216

    Local Storage(HTML5 Web

    Storage Spec)

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    135/216

    Gives UsPower Back

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    136/216

    We Need to beMore Explicit

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    137/216

    App Cache

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    138/216

    }

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    139/216

    }CACHE MANIFESTjavascripts/jquery.jsmedia/logo-tuaw-iphone-v3.pngmedia/favicon-v9-1.png

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    140/216

    }Content-Type:text/cache-manifest

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    141/216

    Rack::Offl ine

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    142/216

    }run Rack :: Offline . new {cache "stylesheets/style.css"cache "images/masthead.jpg"cache "javascripts/application.js"cache "javascripts/jquery.js"network "/"}

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    143/216

    }manifest = Rack :: Offline . new {cache "stylesheets/style.css"cache "images/masthead.jpg"cache "javascripts/application.js"cache "javascripts/jquery.js"network "/"}match "/app.manifest" => manifest

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    144/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    145/216

    }match "/app.manifest" => Rails :: Offline

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    146/216

    Youll AlwaysGet One Stale

    Page

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    147/216

    }$(applicationCache).bind( "updateready" , displayReload);

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    148/216

    Web Storage

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    149/216

    KVS

    }

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    150/216

    }localStorage.article = "Hello!"

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    151/216

    5MB Limit

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    152/216

    Ask For More

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    153/216

    Overwriting aKey WillReclaim

    }

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    154/216

    }delete localStorage[ "article47" ]

    }

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    155/216

    }for (prop in localStorage)

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    156/216

    Basic Strategy:Sip, Dont Gulp

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    157/216

    Rails

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    158/216

    AdaptTechniques forBuilding APIs

    }

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    159/216

    }class Post < ActiveRecord::Basescope :recent , limit( 10 ).order( "created_at desc" ) # or def self.recent ( amount )limit(amount).order( "created_at desc" ) endend

    }

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    160/216

    }class PostsController < ApplicationControllerrespond_to :html , : json , :atom def index @posts = Post .recentrespond_with @posts endend

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    161/216

    ActionDispatchand Rack areVery Robust

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    162/216

    In Real Life...

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    163/216

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    164/216

    Rate Limiting

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    165/216

    ExternalSources

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    166/216

    ProcessUpdates in

    Background

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    167/216

    Caching

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    168/216

    Payments?

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    169/216

    API Integration

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    170/216

    All Things RailsHandles Well

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    171/216

    Plus...

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    172/216

    TraditionalWeb App w/

    Same Backend

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    173/216

    Client-SideStrategy

    First Time

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    174/216

    First TimeDownload HTML

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    175/216

    First TimeDownload HTML

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    176/216

    Async: Download Application Cache

    First TimeDownload HTML

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    177/216

    Async: Download Application Cache

    Display Loading

    First TimeDownload HTML

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    178/216

    Async: Download Application Cache

    Display Loading

    Kick off Request for JSON

    First TimeDownload HTML

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    179/216

    Async: Download Application Cache

    Display Loading

    Kick off Request for JSON

    Store JSON in localStorage

    First TimeDownload HTML

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    180/216

    Async: Download Application Cache

    Display Loading

    Kick off Request for JSON

    Store JSON in localStorage

    Populate Template

    First TimeDownload HTML

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    181/216

    Async: Download Application Cache

    Display Loading

    Kick off Request for JSON

    Store JSON in localStorage

    Populate Template

    Remove Loading

    Subsequent Times

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    182/216

    Subsequent TimesHTML Retrieved from App Cache

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    183/216

    pp

    Subsequent TimesHTML Retrieved from App Cache

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    184/216

    pp

    Async: Check for App Cache Updates

    Subsequent TimesHTML Retrieved from App Cache

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    185/216

    Async: Check for App Cache Updates

    Find Stale Resources in localStorage

    Subsequent TimesHTML Retrieved from App Cache

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    186/216

    Async: Check for App Cache Updates

    Find Stale Resources in localStorage

    Populate Template

    Subsequent TimesHTML Retrieved from App Cache

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    187/216

    Async: Check for App Cache Updates

    Find Stale Resources in localStorage

    Populate Template

    Display Loading

    Subsequent TimesHTML Retrieved from App Cache

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    188/216

    Async: Check for App Cache Updates

    Find Stale Resources in localStorage

    Populate Template

    Display Loading

    Kick off Request for JSON

    Subsequent TimesHTML Retrieved from App Cache

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    189/216

    Async: Check for App Cache Updates

    Find Stale Resources in localStorage

    Populate Template

    Display Loading

    Kick off Request for JSON

    Continue as Before

    }

    Download Application Cache

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    190/216

    }

    }

    Download Application Cache

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    191/216

    }manifest = Rack :: Offline . new {cache "stylesheets/style.css"cache "images/masthead.jpg"cache "javascripts/application.js"cache "javascripts/jquery.js"network "/"}match "/app.manifest" => manifest

    }

    Display Loading

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    192/216

    }$( "#loading" ).show();

    }

    Kick Off Request for JSON

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    193/216

    }$.getJSON( "/stories.json" , updateStories)

    }

    Store JSON in localStorage

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    194/216

    }localStorage.articles = JSON.stringify(json)

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    195/216

    }

    Populate Template

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    196/216

    }{{each(article) articles}} ${article.title} ${article.intro} Comments {{/each}}

    }

    Populate Template

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    197/216

    }var articles = template.render(json.articles)// Single DOM insertion$( "#list" ).empty().append(articles);

    }

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    198/216

    }{{#articles}} {{text}} {{intro}} Comments {{/articles}}

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    199/216

    }

    Populate Template (Mustache)

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    200/216

    }var template = $( "#article" ).html()var articles = Mustache.to_html(template, json.articles)// Single DOM insertion$( "#list" ).empty().append(articles);

    }

    Remove Loading

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    201/216

    }$( "#loading" ).hide()

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    202/216

    Second Time

    }

    Find Stale Resources in localStorage

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    203/216

    }var articles = localStorage.articles;

    }

    Populate Template

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    204/216

    }var articles = localStorage.articles;if (articles) {updateStories(JSON. parse (articles));}

    }

    Display Loading

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    205/216

    }$( "#loading" ).show()

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    206/216

    Continue asBefore

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    207/216

    jquery-o ffl ine

    }

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    208/216

    }$.retrieveJSON( "/stories" , function (json) { var html = template.render(json.articles); $( "#list" ).empty().append(html);});$( "#loading" ).ajaxStart( function () { $( this ).show();}).ajaxStop( function () { $( this ).hide();});

    }

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    209/216

    }$.retrieveJSON( "url" ,function (json, status, follow) { // json == JS Object // status == "success" || "cached" // follow == { cachedAt: originalTime,// retrievedAt: timeRetrieved } });

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    210/216

    Same Processfor Secondary

    Pages

    Tip: Avoid

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    211/216

    Navigation forSecondary

    Pages

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    212/216

    3d AcceleratedTransforms

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    213/216

    CSS is a WholeOther Topic

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    214/216

    Questions?

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    215/216

    June 29 WebinarEvan PhoenixRubinius 1.0

  • 8/9/2019 Mobile Webinar Yehuda 6 10

    216/216

    OptionalEY Cloud