SlideShare a Scribd company logo
1 of 58
Introduction to
Palmā€™s Mojo SDK
      Brendan G. Lim
   brendan@intridea.com
       @brendanlim
Overview
ā€¢   Introduction
ā€¢   Whatā€™s the Mojo SDK?
ā€¢   Introduction to webOS
ā€¢   Creating your ļ¬rst application
ā€¢   Data storage solutions
ā€¢   Overview of UI Widgets
ā€¢   Conclusion
Do you know HTML?
Do you know CSS?
Do you know
 JavaScript?
The Mojo SDK
is a perfect fit
Mojo SDK

ā€¢   JavaScript framework

ā€¢   Bundled with webOS

ā€¢   Model-View-Controller (MVC)

ā€¢   Can use standard web development tools
Mojo SDK

ā€¢   Includes ....

    ā€¢   Prototype, the JavaScript framework

    ā€¢   Mojo Framework & Documentation

    ā€¢   Emulator, DOM Inspector, debugger, etc

    ā€¢   Palm speciļ¬c CSS styles
webOS
ā€¢ Palmā€™s next-gen operating system
ā€¢ Applications built using standard web
  technologies and languages (HTML, CSS,
  JavaScript)
ā€¢ Designed to run on a variety of hardware
  with different screen sizes & resolutions
webOS
ā€¢ User experience is optimized for launching
  and managing multiple applications at once
ā€¢ Integrates a card-based OS with a web
  browser
ā€¢ Applications can run in the background
ā€¢ Applications run off Ajax-based web
  application model
Native App Model

     Native Client

      User Interface


     Server Logic Data
Ajax Web App Model
       Browser Client
         User Interface


        Server Logic Data


    HTTP             DHTML/JavaScript
           Web Server


        Server Logic Data

     Server-side Systems
Launcher




           Quick Launch bar
Cards
        Card View




Cards               Activity
Stages
Card    Activity   Dashboard
Generate an App

palm-generate helloWorld
ā€£ <app>
                   ā€£ <assistants>
                     ā€£ stage-assistant.js
 Structure of      ā€£ <views>
                   ā€£ <images>
an Application     ā€£ <stylesheets>
                   ā€£ appinfo.json
                   ā€£ icon.png
                   ā€£ index.html
appinfo.json
{
    "id": "com.yourdomain.helloworld",
    "version": "1.0",
    "vendor": "My Company",
    "type": "web",
    "main": "index.html",
    "title": "helloWorld",
    "icon": "icon.png"
}
appinfo.json
ā€¢   vender - person or company who made the app
ā€¢   vendorurl - URL of the vendor
ā€¢   visible - whether or not the application is visible within the
    launcher
ā€¢   removeable - tells webOs if you can uninstall this
    application
ā€¢   miniicon - path to icon to be used in the notiļ¬cation area
ā€¢   category - category for the application
ā€¢   noWindow - indivates that this is a headless application that
    will be only called by other applications
helloWorld App
   app/index.html
Packaging an Application

     palm-package helloWorld


The directory where your application was generated
Packaging an Application
Which ends up creating this package:
com.yourdomain.helloworld_1.0_all.ipk
Packaging an Application
     Which ends up creating this package:
     com.yourdomain.helloworld_1.0_all.ipk

   That you can install by doing the following:
palm-install com.yourdomain.helloworld_1.0_all.ipk
Tada!
Scenes
ā€¢   Can think of scenes as separate pages within a
    website.
ā€¢   Mutually exclusive views of the application
    within a Stage
ā€¢   Most applications have different scenes within
    the same stage.
ā€¢   An application must have at least one scene.
ā€¢   Scenes are supported by a controller
    ā€¢   Referred to as a scene assistant
ā€£ <app>
                                   ā€£ <assistants>
                                     ā€£ stage-assistant.js
                                   ā€£ <views>
Generate a Scene                   ā€£ <images>
                                   ā€£ <stylesheets>
palm-generate
 -t new_scene -p "name=First" .    ā€£ appinfo.json
                                   ā€£ icon.png
                                   ā€£ index.html
ā€£ <app>
                                  ā€£ <assistants>
                                    ā€£ ļ¬rst-assistant.js
                                    ā€£ stage-assistant.js
                                  ā€£ <views>
Generate a Scene                    ā€£ <ļ¬rst>
palm-generate                         ā€£ ļ¬rst-scene.html
 -t new_scene -p "name=First" .   ā€£ <images>
                                  ā€£ <stylesheets>
                                  ā€£ appinfo.json
                                  ā€£ icon.png
                                  ā€£ index.html
Linking to a Scene
    app/index.html
Linking to a Scene
app/assistants/stage-assistant.js
Linking to a Scene
app/assistants/stage-assistant.js
Setting up the First Scene
   app/views/ļ¬rst/ļ¬rst-scene.html
After packing & reinstalling
Letā€™s tie in one more scene
Run this in the root of your app directory:
 palm-generate -t new_scene -p "name=Second" .
Setup the Second Scene
       app/index.html
Add Button to First Scene
   app/views/ļ¬rst/ļ¬rst-scene.html
Link Button to Second Scene
    app/assistants/ļ¬rst-assistant.js
Link Button to Second Scene
    app/assistants/ļ¬rst-assistant.js
Setup the Second Scene
 app/views/second/second-scene.html
After packing & reinstalling
Storage
ā€¢ Mojo supports:
 ā€¢ HTML5 database CRUD operations
 ā€¢ Depot
 ā€¢ Cookies
ā€¢ Used for application preferences or to
  cache data
Mojo Depot
ā€¢   Provides a simpliļ¬ed interface to the native HTML5
    database API
ā€¢   Depot is recommended if:
    ā€¢   You are storing simple objects for ofļ¬‚ine access
    ā€¢   You donā€™t need a speciļ¬c schema design
    ā€¢   You have no need for transactions or queries
ā€¢   Limited to 5MB of data per object
ā€¢   Asynchronous callbacks
Using Mojo Depot

Create / Open
Mojo.Depot() - opens a depot with a name that matches or creates a new DB

Read
simpleGet() - returns object it retrieves if thereā€™s a match


Update
simpleAdd()- adds or updates the value of the named object

Delete
removeAll() - removes the named depot and deletes associated data
Using Mojo Depot

Create / Open
var db = new Mojo.Depot({name:ā€dbNameā€, version:1, replace:false}, this.openOK.bind(this), this.openFail.bind(this));



Read
db.simpleGet(ā€œmyDataā€, this.getListOK.bind(this), this.getListFailed.bind(this));


Update
db.simpleAdd(ā€œmyDataā€, myDataContents, this.savedListOK.bind(this), this.savedListFailed.bind(this));


Delete
db.removeAll();
Using Mojo Depot
                                                                                Callbacks
Create / Open
var db = new Mojo.Depot({name:ā€dbNameā€, version:1, replace:false}, this.openOK.bind(this), this.openFail.bind(this));



Read
db.simpleGet(ā€œmyDataā€, this.getListOK.bind(this), this.getListFailed.bind(this));


Update
db.simpleAdd(ā€œmyDataā€, myDataContents, this.savedListOK.bind(this), this.savedListFailed.bind(this));


Delete
db.removeAll();
Using Mojo Depot
var db = new Mojo.Depot({name:ā€dbNameā€, version:1, replace:false}, this.openOK.bind(this), this.openFail.bind(this));




FirstAssistant.prototype.openOk = function() {
    Mojo.Log.info(ā€œ.....ā€,ā€Database openedā€);
    db.simpleGet(ā€œmyDataā€, this.getListOK.bind(this),
      this.getListFailed.bind(this));
}
Mojo Cookies
ā€¢   Simpliļ¬ed interface to cookies
ā€¢   Intended to be used to store small amounts of data
    ā€¢   Application Preferences, versions, or state
        information
ā€¢   webOS creates a ā€œfake domainā€ for individual cookies
    based on the applicationā€™s ID.
ā€¢   Limited to 4KB, but multiple cookies per application is
    acceptable
ā€¢   Synchronous callbacks
Using Mojo Cookies

Create / Open
Mojo.Model.Cookie(id) - opens or creates cookie that matches the id

Read
get() - returns object it retrieves if thereā€™s a match


Update
put()- adds or updates object with an optional date/time to expire

Delete
remove() - removes the cookie and itā€™s data
Using Mojo Cookies

Create / Open
this.cookie = new Mojo.Model.Cookie(ā€œPreferencesā€);


Read
var retrievedPrefs = this.cookie.get();


Update
this.cookie.put({ ...jsonKey: jsonValue ... });


Delete
this.cookie.remove();
UI Widgets
ā€¢   User interface controls to create feature-rich
    interactive applications
ā€¢   Types of widgets:
    ā€¢   Static/dynamic lists, button controls, selectors,
        text ļ¬elds, menus, dialogs, pickers, viewers
ā€¢   Instantiated in a sceneā€™s assistant setup method
    or when speciļ¬ed in an HTML template used by
    another widget.
UI Widgets: Lists
ā€¢ Most important widget in the framework
ā€¢ webOS user experience was built around a
  fast and powerful list widget
ā€¢ Can be used bind dynamic data sources
ā€¢ Can embed other widgets & objects within
  your lists
UI Widgets: Menus
ā€¢ Menu widgets can be used with speciļ¬ed
  areas of the screen
 ā€¢ View & Command menus
  ā€¢ Fully customizable
 ā€¢ App menu handled by the system
  ā€¢ Custom items can be added to these
Summary
ā€¢ If you have a general understanding of
  HTML, CSS, and JavaScript you can start
  developing for Palmā€™s webOS
ā€¢ The MojoSDK is a solid framework that
  allows us to create applications easily
ā€¢ There is MUCH more to the MojoSDK and
  webOS than was covered in this
  presentation.
Questions?

More Related Content

What's hot

Creating the interfaces of the future with the APIs of today
Creating the interfaces of the future with the APIs of todayCreating the interfaces of the future with the APIs of today
Creating the interfaces of the future with the APIs of today
gerbille
Ā 

What's hot (20)

AtlasCamp 2015: Using add-ons to build add-ons
AtlasCamp 2015: Using add-ons to build add-onsAtlasCamp 2015: Using add-ons to build add-ons
AtlasCamp 2015: Using add-ons to build add-ons
Ā 
AtlasCamp 2015: Connect everywhere - Cloud and Server
AtlasCamp 2015: Connect everywhere - Cloud and ServerAtlasCamp 2015: Connect everywhere - Cloud and Server
AtlasCamp 2015: Connect everywhere - Cloud and Server
Ā 
An introduction to Vue.js
An introduction to Vue.jsAn introduction to Vue.js
An introduction to Vue.js
Ā 
AtlasCamp 2015: Web technologies you should be using now
AtlasCamp 2015: Web technologies you should be using nowAtlasCamp 2015: Web technologies you should be using now
AtlasCamp 2015: Web technologies you should be using now
Ā 
JavaFX ā€“ 10 things I love about you
JavaFX ā€“ 10 things I love about youJavaFX ā€“ 10 things I love about you
JavaFX ā€“ 10 things I love about you
Ā 
How to Build SPA with Vue Router 2.0
How to Build SPA with Vue Router 2.0How to Build SPA with Vue Router 2.0
How to Build SPA with Vue Router 2.0
Ā 
Vuex
VuexVuex
Vuex
Ā 
Vaadin Components @ Angular U
Vaadin Components @ Angular UVaadin Components @ Angular U
Vaadin Components @ Angular U
Ā 
Sane Async Patterns
Sane Async PatternsSane Async Patterns
Sane Async Patterns
Ā 
Web components
Web componentsWeb components
Web components
Ā 
Building a js widget
Building a js widgetBuilding a js widget
Building a js widget
Ā 
The Art of AngularJS in 2015 - Angular Summit 2015
The Art of AngularJS in 2015 - Angular Summit 2015The Art of AngularJS in 2015 - Angular Summit 2015
The Art of AngularJS in 2015 - Angular Summit 2015
Ā 
Creating the interfaces of the future with the APIs of today
Creating the interfaces of the future with the APIs of todayCreating the interfaces of the future with the APIs of today
Creating the interfaces of the future with the APIs of today
Ā 
Introduction to backbone presentation
Introduction to backbone presentationIntroduction to backbone presentation
Introduction to backbone presentation
Ā 
An introduction to Vue.js
An introduction to Vue.jsAn introduction to Vue.js
An introduction to Vue.js
Ā 
The Complementarity of React and Web Components
The Complementarity of React and Web ComponentsThe Complementarity of React and Web Components
The Complementarity of React and Web Components
Ā 
Angular JS blog tutorial
Angular JS blog tutorialAngular JS blog tutorial
Angular JS blog tutorial
Ā 
Vaadin Components
Vaadin ComponentsVaadin Components
Vaadin Components
Ā 
Js Saturday 2013 your jQuery could perform better
Js Saturday 2013 your jQuery could perform betterJs Saturday 2013 your jQuery could perform better
Js Saturday 2013 your jQuery could perform better
Ā 
jQuery for web development
jQuery for web developmentjQuery for web development
jQuery for web development
Ā 

Viewers also liked

ExL Pharma Clinical Trials Phase I and Phase IIa Conference Brochure: Phase 1...
ExL Pharma Clinical Trials Phase I and Phase IIa Conference Brochure: Phase 1...ExL Pharma Clinical Trials Phase I and Phase IIa Conference Brochure: Phase 1...
ExL Pharma Clinical Trials Phase I and Phase IIa Conference Brochure: Phase 1...
bryonmain
Ā 
Heart diseases
Heart diseasesHeart diseases
Heart diseases
Heena Modi
Ā 
Adjective Jingle
Adjective JingleAdjective Jingle
Adjective Jingle
lorie.schaller
Ā 
Zum kapuzinerberg
Zum kapuzinerbergZum kapuzinerberg
Zum kapuzinerberg
Heena Modi
Ā 
Dining in salzburg
Dining in salzburgDining in salzburg
Dining in salzburg
Heena Modi
Ā 
2013 Jean Fares Couture collection look book
2013 Jean Fares Couture collection look book2013 Jean Fares Couture collection look book
2013 Jean Fares Couture collection look book
Norma HAYEK
Ā 
Poonam and jaiminā€™s wedding day
Poonam and jaiminā€™s wedding dayPoonam and jaiminā€™s wedding day
Poonam and jaiminā€™s wedding day
Heena Modi
Ā 
The gorgeous pearl
The gorgeous pearlThe gorgeous pearl
The gorgeous pearl
Heena Modi
Ā 
Jikumbushe
JikumbusheJikumbushe
Jikumbushe
Heena Modi
Ā 
Before and after decorating our new home
Before and after decorating our new homeBefore and after decorating our new home
Before and after decorating our new home
Heena Modi
Ā 
10 words
10 words10 words
10 words
Heena Modi
Ā 
Schloss mirabell
Schloss mirabellSchloss mirabell
Schloss mirabell
Heena Modi
Ā 

Viewers also liked (20)

ExL Pharma Clinical Trials Phase I and Phase IIa Conference Brochure: Phase 1...
ExL Pharma Clinical Trials Phase I and Phase IIa Conference Brochure: Phase 1...ExL Pharma Clinical Trials Phase I and Phase IIa Conference Brochure: Phase 1...
ExL Pharma Clinical Trials Phase I and Phase IIa Conference Brochure: Phase 1...
Ā 
Heart diseases
Heart diseasesHeart diseases
Heart diseases
Ā 
Adjective Jingle
Adjective JingleAdjective Jingle
Adjective Jingle
Ā 
Im Mobile Who's Coming With Me
Im Mobile Who's Coming With MeIm Mobile Who's Coming With Me
Im Mobile Who's Coming With Me
Ā 
Zum kapuzinerberg
Zum kapuzinerbergZum kapuzinerberg
Zum kapuzinerberg
Ā 
Dining in salzburg
Dining in salzburgDining in salzburg
Dining in salzburg
Ā 
The broiler hen
The broiler hen The broiler hen
The broiler hen
Ā 
2013 Jean Fares Couture collection look book
2013 Jean Fares Couture collection look book2013 Jean Fares Couture collection look book
2013 Jean Fares Couture collection look book
Ā 
Poonam and jaiminā€™s wedding day
Poonam and jaiminā€™s wedding dayPoonam and jaiminā€™s wedding day
Poonam and jaiminā€™s wedding day
Ā 
Connect Faster And Learn More With Friend Feed
Connect Faster And Learn More With Friend FeedConnect Faster And Learn More With Friend Feed
Connect Faster And Learn More With Friend Feed
Ā 
The gorgeous pearl
The gorgeous pearlThe gorgeous pearl
The gorgeous pearl
Ā 
Jikumbushe
JikumbusheJikumbushe
Jikumbushe
Ā 
DSA - Lecture 03
DSA - Lecture 03DSA - Lecture 03
DSA - Lecture 03
Ā 
Lecture 02 - DSA
Lecture 02 - DSALecture 02 - DSA
Lecture 02 - DSA
Ā 
Before and after decorating our new home
Before and after decorating our new homeBefore and after decorating our new home
Before and after decorating our new home
Ā 
10 words
10 words10 words
10 words
Ā 
MSS Business Integration Practice Ibm Web Sphere
MSS Business Integration Practice   Ibm Web SphereMSS Business Integration Practice   Ibm Web Sphere
MSS Business Integration Practice Ibm Web Sphere
Ā 
Evolving Trends and Fashion in Egypt with Jean Fares
Evolving Trends and Fashion in Egypt with Jean FaresEvolving Trends and Fashion in Egypt with Jean Fares
Evolving Trends and Fashion in Egypt with Jean Fares
Ā 
Lrrcm Analysis Process
Lrrcm Analysis ProcessLrrcm Analysis Process
Lrrcm Analysis Process
Ā 
Schloss mirabell
Schloss mirabellSchloss mirabell
Schloss mirabell
Ā 

Similar to Introduction to Palm's Mojo SDK

Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development
Mahmoud Hamed Mahmoud
Ā 
Web APIs & Apps - Mozilla
Web APIs & Apps - MozillaWeb APIs & Apps - Mozilla
Web APIs & Apps - Mozilla
Robert Nyman
Ā 
Os Haase
Os HaaseOs Haase
Os Haase
oscon2007
Ā 

Similar to Introduction to Palm's Mojo SDK (20)

Intro To webOS
Intro To webOSIntro To webOS
Intro To webOS
Ā 
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Ā 
Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development
Ā 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
Ā 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
Ā 
企äøšēŗ§č½Æ件ēš„ē»„件化和åŠØę€åŒ–å¼€å‘å®žč·µ
企äøšēŗ§č½Æ件ēš„ē»„件化和åŠØę€åŒ–å¼€å‘å®žč·µä¼äøšēŗ§č½Æ件ēš„ē»„件化和åŠØę€åŒ–å¼€å‘å®žč·µ
企äøšēŗ§č½Æ件ēš„ē»„件化和åŠØę€åŒ–å¼€å‘å®žč·µ
Ā 
Lec005 android start_program
Lec005 android start_programLec005 android start_program
Lec005 android start_program
Ā 
Web APIs & Apps - Mozilla
Web APIs & Apps - MozillaWeb APIs & Apps - Mozilla
Web APIs & Apps - Mozilla
Ā 
Building iPad apps with Flex - 360Flex
Building iPad apps with Flex - 360FlexBuilding iPad apps with Flex - 360Flex
Building iPad apps with Flex - 360Flex
Ā 
React django
React djangoReact django
React django
Ā 
Building WebApp with HTML5
Building WebApp with HTML5Building WebApp with HTML5
Building WebApp with HTML5
Ā 
"Progressive Web Apps" by Riza Fahmi (Hacktiv8)
"Progressive Web Apps" by Riza Fahmi	(Hacktiv8)"Progressive Web Apps" by Riza Fahmi	(Hacktiv8)
"Progressive Web Apps" by Riza Fahmi (Hacktiv8)
Ā 
Progressive Web Apps. What, why and how
Progressive Web Apps. What, why and howProgressive Web Apps. What, why and how
Progressive Web Apps. What, why and how
Ā 
JavaScript on the Desktop
JavaScript on the DesktopJavaScript on the Desktop
JavaScript on the Desktop
Ā 
Magento++
Magento++Magento++
Magento++
Ā 
SharePoint Saturday Atlanta 2015
SharePoint Saturday Atlanta 2015SharePoint Saturday Atlanta 2015
SharePoint Saturday Atlanta 2015
Ā 
Zend framework
Zend frameworkZend framework
Zend framework
Ā 
XPages Blast - ILUG 2010
XPages Blast - ILUG 2010XPages Blast - ILUG 2010
XPages Blast - ILUG 2010
Ā 
Os Haase
Os HaaseOs Haase
Os Haase
Ā 
Vaadin 7 CN
Vaadin 7 CNVaadin 7 CN
Vaadin 7 CN
Ā 

More from Brendan Lim (6)

Developing Cocoa Applications with macRuby
Developing Cocoa Applications with macRubyDeveloping Cocoa Applications with macRuby
Developing Cocoa Applications with macRuby
Ā 
Building Native Apps With Titanium Mobile
Building Native Apps With Titanium MobileBuilding Native Apps With Titanium Mobile
Building Native Apps With Titanium Mobile
Ā 
MacRuby to The Max
MacRuby to The MaxMacRuby to The Max
MacRuby to The Max
Ā 
The Lure Of Ubiquitous Mobile
The Lure Of Ubiquitous MobileThe Lure Of Ubiquitous Mobile
The Lure Of Ubiquitous Mobile
Ā 
Mobilizing Your Rails Application - Rails Underground, London, UK
Mobilizing Your Rails Application - Rails Underground, London, UKMobilizing Your Rails Application - Rails Underground, London, UK
Mobilizing Your Rails Application - Rails Underground, London, UK
Ā 
Mobilizing Your Rails Application - LA Ruby Conference 2009
Mobilizing Your Rails Application - LA Ruby Conference 2009Mobilizing Your Rails Application - LA Ruby Conference 2009
Mobilizing Your Rails Application - LA Ruby Conference 2009
Ā 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
Ā 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
Ā 

Recently uploaded (20)

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
Ā 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Ā 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
Ā 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Ā 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
Ā 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
Ā 
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
Ā 
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
Ā 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Ā 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
Ā 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
Ā 
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
Ā 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Ā 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
Ā 
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
Ā 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
Ā 
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
Ā 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Ā 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
Ā 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Ā 

Introduction to Palm's Mojo SDK

  • 1. Introduction to Palmā€™s Mojo SDK Brendan G. Lim brendan@intridea.com @brendanlim
  • 2. Overview ā€¢ Introduction ā€¢ Whatā€™s the Mojo SDK? ā€¢ Introduction to webOS ā€¢ Creating your ļ¬rst application ā€¢ Data storage solutions ā€¢ Overview of UI Widgets ā€¢ Conclusion
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8. Do you know HTML?
  • 9. Do you know CSS?
  • 10. Do you know JavaScript?
  • 11. The Mojo SDK is a perfect fit
  • 12. Mojo SDK ā€¢ JavaScript framework ā€¢ Bundled with webOS ā€¢ Model-View-Controller (MVC) ā€¢ Can use standard web development tools
  • 13. Mojo SDK ā€¢ Includes .... ā€¢ Prototype, the JavaScript framework ā€¢ Mojo Framework & Documentation ā€¢ Emulator, DOM Inspector, debugger, etc ā€¢ Palm speciļ¬c CSS styles
  • 14. webOS ā€¢ Palmā€™s next-gen operating system ā€¢ Applications built using standard web technologies and languages (HTML, CSS, JavaScript) ā€¢ Designed to run on a variety of hardware with different screen sizes & resolutions
  • 15. webOS ā€¢ User experience is optimized for launching and managing multiple applications at once ā€¢ Integrates a card-based OS with a web browser ā€¢ Applications can run in the background ā€¢ Applications run off Ajax-based web application model
  • 16. Native App Model Native Client User Interface Server Logic Data
  • 17. Ajax Web App Model Browser Client User Interface Server Logic Data HTTP DHTML/JavaScript Web Server Server Logic Data Server-side Systems
  • 18. Launcher Quick Launch bar
  • 19. Cards Card View Cards Activity
  • 20. Stages Card Activity Dashboard
  • 22. ā€£ <app> ā€£ <assistants> ā€£ stage-assistant.js Structure of ā€£ <views> ā€£ <images> an Application ā€£ <stylesheets> ā€£ appinfo.json ā€£ icon.png ā€£ index.html
  • 23. appinfo.json { "id": "com.yourdomain.helloworld", "version": "1.0", "vendor": "My Company", "type": "web", "main": "index.html", "title": "helloWorld", "icon": "icon.png" }
  • 24. appinfo.json ā€¢ vender - person or company who made the app ā€¢ vendorurl - URL of the vendor ā€¢ visible - whether or not the application is visible within the launcher ā€¢ removeable - tells webOs if you can uninstall this application ā€¢ miniicon - path to icon to be used in the notiļ¬cation area ā€¢ category - category for the application ā€¢ noWindow - indivates that this is a headless application that will be only called by other applications
  • 25. helloWorld App app/index.html
  • 26. Packaging an Application palm-package helloWorld The directory where your application was generated
  • 27. Packaging an Application Which ends up creating this package: com.yourdomain.helloworld_1.0_all.ipk
  • 28. Packaging an Application Which ends up creating this package: com.yourdomain.helloworld_1.0_all.ipk That you can install by doing the following: palm-install com.yourdomain.helloworld_1.0_all.ipk
  • 29. Tada!
  • 30. Scenes ā€¢ Can think of scenes as separate pages within a website. ā€¢ Mutually exclusive views of the application within a Stage ā€¢ Most applications have different scenes within the same stage. ā€¢ An application must have at least one scene. ā€¢ Scenes are supported by a controller ā€¢ Referred to as a scene assistant
  • 31. ā€£ <app> ā€£ <assistants> ā€£ stage-assistant.js ā€£ <views> Generate a Scene ā€£ <images> ā€£ <stylesheets> palm-generate -t new_scene -p "name=First" . ā€£ appinfo.json ā€£ icon.png ā€£ index.html
  • 32. ā€£ <app> ā€£ <assistants> ā€£ ļ¬rst-assistant.js ā€£ stage-assistant.js ā€£ <views> Generate a Scene ā€£ <ļ¬rst> palm-generate ā€£ ļ¬rst-scene.html -t new_scene -p "name=First" . ā€£ <images> ā€£ <stylesheets> ā€£ appinfo.json ā€£ icon.png ā€£ index.html
  • 33. Linking to a Scene app/index.html
  • 34. Linking to a Scene app/assistants/stage-assistant.js
  • 35. Linking to a Scene app/assistants/stage-assistant.js
  • 36. Setting up the First Scene app/views/ļ¬rst/ļ¬rst-scene.html
  • 37. After packing & reinstalling
  • 38. Letā€™s tie in one more scene Run this in the root of your app directory: palm-generate -t new_scene -p "name=Second" .
  • 39. Setup the Second Scene app/index.html
  • 40. Add Button to First Scene app/views/ļ¬rst/ļ¬rst-scene.html
  • 41. Link Button to Second Scene app/assistants/ļ¬rst-assistant.js
  • 42. Link Button to Second Scene app/assistants/ļ¬rst-assistant.js
  • 43. Setup the Second Scene app/views/second/second-scene.html
  • 44. After packing & reinstalling
  • 45. Storage ā€¢ Mojo supports: ā€¢ HTML5 database CRUD operations ā€¢ Depot ā€¢ Cookies ā€¢ Used for application preferences or to cache data
  • 46. Mojo Depot ā€¢ Provides a simpliļ¬ed interface to the native HTML5 database API ā€¢ Depot is recommended if: ā€¢ You are storing simple objects for ofļ¬‚ine access ā€¢ You donā€™t need a speciļ¬c schema design ā€¢ You have no need for transactions or queries ā€¢ Limited to 5MB of data per object ā€¢ Asynchronous callbacks
  • 47. Using Mojo Depot Create / Open Mojo.Depot() - opens a depot with a name that matches or creates a new DB Read simpleGet() - returns object it retrieves if thereā€™s a match Update simpleAdd()- adds or updates the value of the named object Delete removeAll() - removes the named depot and deletes associated data
  • 48. Using Mojo Depot Create / Open var db = new Mojo.Depot({name:ā€dbNameā€, version:1, replace:false}, this.openOK.bind(this), this.openFail.bind(this)); Read db.simpleGet(ā€œmyDataā€, this.getListOK.bind(this), this.getListFailed.bind(this)); Update db.simpleAdd(ā€œmyDataā€, myDataContents, this.savedListOK.bind(this), this.savedListFailed.bind(this)); Delete db.removeAll();
  • 49. Using Mojo Depot Callbacks Create / Open var db = new Mojo.Depot({name:ā€dbNameā€, version:1, replace:false}, this.openOK.bind(this), this.openFail.bind(this)); Read db.simpleGet(ā€œmyDataā€, this.getListOK.bind(this), this.getListFailed.bind(this)); Update db.simpleAdd(ā€œmyDataā€, myDataContents, this.savedListOK.bind(this), this.savedListFailed.bind(this)); Delete db.removeAll();
  • 50. Using Mojo Depot var db = new Mojo.Depot({name:ā€dbNameā€, version:1, replace:false}, this.openOK.bind(this), this.openFail.bind(this)); FirstAssistant.prototype.openOk = function() { Mojo.Log.info(ā€œ.....ā€,ā€Database openedā€); db.simpleGet(ā€œmyDataā€, this.getListOK.bind(this), this.getListFailed.bind(this)); }
  • 51. Mojo Cookies ā€¢ Simpliļ¬ed interface to cookies ā€¢ Intended to be used to store small amounts of data ā€¢ Application Preferences, versions, or state information ā€¢ webOS creates a ā€œfake domainā€ for individual cookies based on the applicationā€™s ID. ā€¢ Limited to 4KB, but multiple cookies per application is acceptable ā€¢ Synchronous callbacks
  • 52. Using Mojo Cookies Create / Open Mojo.Model.Cookie(id) - opens or creates cookie that matches the id Read get() - returns object it retrieves if thereā€™s a match Update put()- adds or updates object with an optional date/time to expire Delete remove() - removes the cookie and itā€™s data
  • 53. Using Mojo Cookies Create / Open this.cookie = new Mojo.Model.Cookie(ā€œPreferencesā€); Read var retrievedPrefs = this.cookie.get(); Update this.cookie.put({ ...jsonKey: jsonValue ... }); Delete this.cookie.remove();
  • 54. UI Widgets ā€¢ User interface controls to create feature-rich interactive applications ā€¢ Types of widgets: ā€¢ Static/dynamic lists, button controls, selectors, text ļ¬elds, menus, dialogs, pickers, viewers ā€¢ Instantiated in a sceneā€™s assistant setup method or when speciļ¬ed in an HTML template used by another widget.
  • 55. UI Widgets: Lists ā€¢ Most important widget in the framework ā€¢ webOS user experience was built around a fast and powerful list widget ā€¢ Can be used bind dynamic data sources ā€¢ Can embed other widgets & objects within your lists
  • 56. UI Widgets: Menus ā€¢ Menu widgets can be used with speciļ¬ed areas of the screen ā€¢ View & Command menus ā€¢ Fully customizable ā€¢ App menu handled by the system ā€¢ Custom items can be added to these
  • 57. Summary ā€¢ If you have a general understanding of HTML, CSS, and JavaScript you can start developing for Palmā€™s webOS ā€¢ The MojoSDK is a solid framework that allows us to create applications easily ā€¢ There is MUCH more to the MojoSDK and webOS than was covered in this presentation.

Editor's Notes

  1. Some of our products include applications like Present.ly, a microblogging solution for businesses.
  2. Scalr, which allows you to take advantage of Amazon&amp;#x2019;s EC2 service without poking your eyeballs out.
  3. CrowdSound, which allows your customers to leave feedback on your applications.
  4. ... and MediaPlug which allows you to offload long user uploads and do complex transcoding and manipulations automagically without your users having to leave your site.
  5. This is the native application model, which Palm OS had and other major mobile platforms use. In this model the app is installed as an executable on the native OS with direct access to the OS&amp;#x2019;s data and services.
  6. This is the application model that Palm&amp;#x2019;s webOS uses. Ajax apps have some nice advantages over embedded apps. They can be more easily deployed and updated through the same techniques used for web applications. It&amp;#x2019;s also much easier for most developers to jump in since it&amp;#x2019;s just like web apps. This is big for web development shops with developers that aren&amp;#x2019;t familiar with Java or Objective-C. Since they all know how to make web apps, they are all essentially mobile developers bc of Palm&amp;#x2019;s Mojo SDK.
  7. Cards were inspired by the way one person handles a deck of cards. webOS works similarly by allowing you to scroll through cards, select cards and flicking cards off the top of the screen to remove them or select them and drag them to a new location. There are cards, the expanded card view and the individual activity view.
  8. webOS applications can have one or more stages. Here you can see the Card stage, Activity stage, and the Dashboard stage. Stages are declarative HTML structures similar to a traditional HTML window or browser tab. For example the Inbox view may be one stage and the screen to create a new e-mail would be another stage.
  9. So, this is the initial structure of the application after you generate your helloWorld application. Within app there is the assistants folder, views for your HTML files, images, stylsheets, etc. The important file here is appinfo.json which holds all the info for your application. The icon is what is shown in the launcher for your application. Also, like a regular web page, index.html is the initial view that is loaded.
  10. So the appinfo.json file is one of the most important files in your application. It contains the information to load and launch your application. The id specifies the package name for your account. Everything else is pretty much self explanatory. There&amp;#x2019;s a bunch of other options you can include here as well ...
  11. Here are some of the other options you can add in to your appInfo.json
  12. So, this is the index.html page that is automatically generated for you. The mojo framework is automatically included for you in the script tag above. You must include this in every application. Also you can notice below, there&amp;#x2019;s sample text that is automatically generated for you to verify that your application actually runs. If you end up creating other stages or other scenes you have to include the assistants for those. We&amp;#x2019;ll go into this in just a second.
  13. Most applications will have multiple scenes. An example of an application with only one scene, though, would be a Calculator. Scenes are managed like a stack with new scenes &amp;#x2018;pushed&amp;#x2019; onto and off of the stack with the last scene on the stack visible in the view.
  14. palm-generate -t (task) new_scene with properties of name = to first. So you can see on the right the old directory structure from when we initially generated the application earlier.
  15. So, after you run this command you can see that the first assistant was added and a new folder called &amp;#x2018;first&amp;#x2019; and an html page called first-scene.html has been created.
  16. So, if we go into index.htm, we&amp;#x2019;re going to want to add in stage-assistant and first-assistant. The stage assistant sets up any application-wide objects and pushes the first scene onto the stack. The scene assistant allows you to control that scene&amp;#x2019;s behavior.
  17. This is the code generated for you within stage-assistant sans the comments. Here we&amp;#x2019;re going to want to add a new call to the setup method, which gets run when the application gets started.
  18. Here, we&amp;#x2019;re telling the stage assistant to go ahead and load the first scene when we launch the application.
  19. Since it won&amp;#x2019;t be any fun to link to a bank page, we&amp;#x2019;re going to add some html to our first scene. As you can see here, it&amp;#x2019;s just straight HTML. The CSS classes you see above are built in styling that comes with the MojoSDK, which you can also override if you want to. Palm actually has a set of Human Interface Guidelines just like Apple does with the iPhone -- so make sure that if you do end up overriding these styles, you are within their guidelines.
  20. So, after
  21. Now that we&amp;#x2019;ve created the second scene, we have to do what we did to the first scene and add in the second-assistant to our index page.
  22. So, within our first scene I&amp;#x2019;m adding a button with the standard palm-button styling and with an id of myButton so that I can reference it within an assistant.
  23. So, this here is what is generated for you for a specific assistant. In this case this is our first assistant file that was generated for us earlier when we created that scene. I made sure to take out the comments within the javascript file since it took up way too much space to fit within this slide.
  24. So, within the setup function, which gets called when this scene is loaded, we&amp;#x2019;re going to want to setup an event listener for &amp;#x2018;myButton&amp;#x2019;, which we specifically specified in the html page. So when we &amp;#x2018;click&amp;#x2019; we&amp;#x2019;re going to want to go to launch the nextScene function. So if you look on the bottom you can see in the nextScene function, we make the Mojo controller push the second scene onto the stack.
  25. and like the first, let&amp;#x2019;s add some goods to our second scene so we have something to look at.
  26. Depot, which is just a simplified interface to the HTML5 database API Cookies are your standard HTTP cookies
  27. Widgets support the webOS interface and Mojo defines the styles for each of the widgets. The styling for them is already available by declaring and using the widgets -- although styling can be overridden with custom CSS. The List widget is the most important in the framework since webOS was built around a fast and power list widget experience.
  28. The List widget is the most important in the framework since webOS was built around a fast and power list widget experience. You can use lists to bind dynamic data sources with instant filtering and you can also embed other widgets &amp; objects within your lists
  29. Menu widgets can be used with specified areas of the screen. - The App Menu is a regular desktop style menu on the top left of the screen. - The View Menu applies to menus across the top of the screen and can be used as your display header - The Command Menu is used to set a menu at the bottom of the screen Unlike other widgets, the menu widgets aren&amp;#x2019;t declared in your scene view. They are instantiated completely within the scene assistant within the setupWidget call.