Results 1 to 6 of 6
  1.    #1  
    I've seen quite a few examples of apps and the one thing that keeps nagging at me is what is the difference between putting your html/css in index html or a first-scene html? I've also seen examples from the weboshelp site that includes all .jsjsjs $files$ $in$ $index$ $but$ $then$ $other$ $examples$ $only$ $include$ $the$ $mojo$ $framework$ $and$ $somehow$ $webos$ $magically$ $knows$ $to$ $load$ $in$ $the$ $proper$ $scenes$ $and$ $assistants$. $Can$ $anyone$ $explain$ $this$?
  2. #2  
    Quote Originally Posted by mattbrad2 View Post
    I've seen quite a few examples of apps and the one thing that keeps nagging at me is what is the difference between putting your html/css in index html or a first-scene html? I've also seen examples from the weboshelp site that includes all .jsjsjs $files$ $in$ $index$ $but$ $then$ $other$ $examples$ $only$ $include$ $the$ $mojo$ $framework$ $and$ $somehow$ $webos$ $magically$ $knows$ $to$ $load$ $in$ $the$ $proper$ $scenes$ $and$ $assistants$. $Can$ $anyone$ $explain$ $this$?
    I haven't done Javascript programming in a long time. So I'm confused by most of this as well.

    As far as I can tell the the examples that don't have all the .jsjsjs $includes$ $in$ $the$ $index$.$html$ $have$ $them$ $in$ $a$ $file$ $called$ $sources$.$json$. $That$ $tells$ $webos$ $what$ .$js$ $files$ $to$ $include$. $Also$ $looks$ $like$ $most$ $newer$ $apps$ $use$ $a$ $model$ $where$ $you$ $put$ $all$ $sources$ $in$ $sources$.$json$ $then$ $create$ $a$ .$js$ $that$ $is$ $either$ $called$ $an$ $app$-$assistant$ $or$ $a$ $stage$-$assistant$. $The$ $stage$ $assistant$ $is$ $the$ $first$ .$js$ $to$ $get$ $called$ $and$ $it$ $has$ $code$ $in$ $there$ $that$ $pushes$ $the$ $first$-$scene$.$html$ $onto$ $the$ $viewable$ $web$ $stack$.... $Also$ $most$ $the$ $index$.$htmls$ $in$ $the$ $newer$ $apps$ $only$ $have$ $the$ $include$ $for$ $frameworks$ $such$ $as$ $mojo$.$js$ $and$ $audio$.$js$ $but$ $don$'$t$ $contain$ $any$ $content$.

    I might be way off but that is how I understand it so far.. .. Please someone correct me if I'm wrong.
  3. #3  
    Just wait for the SDK to be officially released. It's not ready for prime time yet and all your questions will probably be answered in documentation.
  4. #4  
    The reason for the index.html is so the Mojo framework can get loaded. Once loaded the framework will make its call to the stage-assistant.jsjsjs $file$. $You$ $are$ $free$ $to$ $add$ $you$ $other$ $javascript$ $references$ $here$, $but$ $this$ $can$ $effect$ $your$ $application$ $load$ $time$ $so$ $Palm$ $recommends$ $you$ $use$ $the$ $sources$.$json$ $file$ $to$ $do$ $all$ $your$ $javascript$ $includes$. $This$ $way$ $the$ $framework$ $will$ $load$ $them$ $when$ $needed$ $instead$ $of$ $all$ $at$ $once$.

    In addition to the above, the rough cuts books states the following for any app that uses multiple stages (an app that uses more than one card or uses any of the notification features,etc).

    JavaScript loading through sources.json is required; multi-stage applications will fail
    unless the source files are specified in sources.json as loading JavaScript through
    script tags will not work (other than the required script tag for mojo.jsjsjs).
    Last edited by Arcticus; 07/01/2009 at 02:18 PM.
  5. JustinZ's Avatar
    Posts
    27 Posts
    Global Posts
    29 Global Posts
    #5  
    One efficiency advantage of putting the .jsjsjs $includes$ $in$ $sources$.$json$ $is$ $that$ $they$ $don$'$t$ $get$ $loaded$ $unless$ $they$'$re$ $needed$. $If$ $you$ $have$ $two$ $scenes$, $the$ .$js$ $for$ $the$ $second$ $scene$ $doesn$'$t$ $get$ $loaded$ $until$ $you$ $start$ $the$ $second$ $scene$. $If$ $the$ $user$ $never$ $goes$ $into$ $the$ $second$ $scene$ ($e$.$g$. $week$ $view$ $in$ $the$ $Calendar$), $then$ $you$ $never$ $waste$ $time$/$space$ $loading$ $the$ .$js$ $files$.
  6. #6  
    Besides the performance increase of not loading unused .jsjsjs $files$, $this$ $will$ $also$ $make$ $your$ $application$ $more$ $maintainable$ $by$ $separating$ $the$ $UI$ $into$ $different$ $files$. $If$ $someone$ $else$ $comes$ $along$ $and$ $looks$ $at$ $your$ $code$ $it$'$ll$ $hopefully$ $be$ $easier$ $for$ $them$ $to$ $understand$ $what$ $your$ $doing$.

    For small 1 or 2 scene apps it probably doesnt matter, but if you start getting to 5 or more it can make a difference.

Posting Permissions