webOS The Platform You Already Know Eric Marthinsen and Gary Smith Agile Commerce
Agenda Terminology Technologies Similarities Differences What next?
Terminology Palm Pre webOS Mojo
Technologies HTML CSS JavaScript
Similarities Structure Model View Controller (MVC) paradigm Very close in style and form to Ruby on Rails Philosophy Helper tools, similar to Ruby on Rails Convention over configuration Coding HTML, CSS, and JavaScript – follows typical web paradigms
Structure Ruby on Rails app controllers     models      views public      images      stylesheets  Mojo app assistants models views images stylesheets Mojo applications are MVC applications.
Philosophy Mojo follows closely to many core concepts in Ruby on Rails. Convention over configuration ruby script/generate  versus  palm-generate
Code: HTML HTML <div style=”background: red”> This is some text </div> webOS <div style=”background: red”> This is some text </div>
Code: Finding an Element HTML document.findElementById(“id”) $('id') webOS document.findElementById(“id”) $('id') this.controller.get('id')
Code: Wiring up an Event Handler HTML elem.onclick = this.handler Event.observe('elemName', 'click', this.handler) webOS Mojo.Event.listen(element, Mojo.Event.tap, this.handler)
Code: Ajax A typical AJAX call:    var url = &quot;http://api.example.com&quot;; new Ajax.Request(url, {   method: 'get',   onSuccess: function(transport) {   console.log(&quot;SUCCESS!!!&quot;);   },   onFailure: function() {   console.log(&quot;FAILURE&quot;);   } });
Code: Ajax Accessing the GPS System Service in Mojo:    var url = &quot;palm://com.palm.location&quot;;    this.controller.serviceRequest(url, {    method:&quot;startTracking&quot;,   parameters:{ subscribe: true },   onSuccess: function(result){     console.log(&quot;GOT A NEW LOCATION&quot;);   },   onFailure: function(result){     console.log(&quot;FAILURE&quot;);   } });
Code: Widgets SWFobject <div id=&quot;myContent&quot;></div> swfobject.embedSWF( &quot;myContent.swf&quot;, &quot;myContent&quot;, &quot;300&quot;, &quot;120&quot;, &quot;9.0.0&quot; );
Code: Widgets Simple slider widget in jQuery <div id=&quot;slider&quot;></div> $(&quot;#slider&quot;).slider();
Code: Widgets TextField in Mojo <div id=&quot;searchString&quot; x-mojo-element=&quot;TextField&quot;></div> this.controller.setupWidget( &quot;searchString&quot;, { hintText: 'enter search criteria', multiline: false }, this.searchModel = { value: “” } );
Differences: JavaScript It is not like Java or a scripting language More like Self or Scheme It has objects, but no classes Functions can have properties (which can be functions themselves) “ this” isn't always that
Differences: Mojo API Any platform has a set of APIs, Mojo is no exception
What Next? Learn JavaScript JavaScript: The Good Parts Douglas Crockford
What Next? Get Mitch's Book Palm webOS Mitch Allen Available through O'Reilly
One Last Resource

You Know WebOS

  • 1.
    webOS The PlatformYou Already Know Eric Marthinsen and Gary Smith Agile Commerce
  • 2.
    Agenda Terminology TechnologiesSimilarities Differences What next?
  • 3.
  • 4.
  • 5.
    Similarities Structure ModelView Controller (MVC) paradigm Very close in style and form to Ruby on Rails Philosophy Helper tools, similar to Ruby on Rails Convention over configuration Coding HTML, CSS, and JavaScript – follows typical web paradigms
  • 6.
    Structure Ruby onRails app controllers    models     views public     images     stylesheets Mojo app assistants models views images stylesheets Mojo applications are MVC applications.
  • 7.
    Philosophy Mojo followsclosely to many core concepts in Ruby on Rails. Convention over configuration ruby script/generate versus palm-generate
  • 8.
    Code: HTML HTML<div style=”background: red”> This is some text </div> webOS <div style=”background: red”> This is some text </div>
  • 9.
    Code: Finding anElement HTML document.findElementById(“id”) $('id') webOS document.findElementById(“id”) $('id') this.controller.get('id')
  • 10.
    Code: Wiring upan Event Handler HTML elem.onclick = this.handler Event.observe('elemName', 'click', this.handler) webOS Mojo.Event.listen(element, Mojo.Event.tap, this.handler)
  • 11.
    Code: Ajax Atypical AJAX call:    var url = &quot;http://api.example.com&quot;; new Ajax.Request(url, { method: 'get', onSuccess: function(transport) { console.log(&quot;SUCCESS!!!&quot;); }, onFailure: function() { console.log(&quot;FAILURE&quot;); } });
  • 12.
    Code: Ajax Accessingthe GPS System Service in Mojo:    var url = &quot;palm://com.palm.location&quot;;    this.controller.serviceRequest(url, {   method:&quot;startTracking&quot;,   parameters:{ subscribe: true },   onSuccess: function(result){     console.log(&quot;GOT A NEW LOCATION&quot;);   },   onFailure: function(result){     console.log(&quot;FAILURE&quot;);   } });
  • 13.
    Code: Widgets SWFobject<div id=&quot;myContent&quot;></div> swfobject.embedSWF( &quot;myContent.swf&quot;, &quot;myContent&quot;, &quot;300&quot;, &quot;120&quot;, &quot;9.0.0&quot; );
  • 14.
    Code: Widgets Simpleslider widget in jQuery <div id=&quot;slider&quot;></div> $(&quot;#slider&quot;).slider();
  • 15.
    Code: Widgets TextFieldin Mojo <div id=&quot;searchString&quot; x-mojo-element=&quot;TextField&quot;></div> this.controller.setupWidget( &quot;searchString&quot;, { hintText: 'enter search criteria', multiline: false }, this.searchModel = { value: “” } );
  • 16.
    Differences: JavaScript Itis not like Java or a scripting language More like Self or Scheme It has objects, but no classes Functions can have properties (which can be functions themselves) “ this” isn't always that
  • 17.
    Differences: Mojo APIAny platform has a set of APIs, Mojo is no exception
  • 18.
    What Next? LearnJavaScript JavaScript: The Good Parts Douglas Crockford
  • 19.
    What Next? GetMitch's Book Palm webOS Mitch Allen Available through O'Reilly
  • 20.