web apis

unleashing the power of open web apps




Germán Toro del Valle

Web (apps) today

this is unstoppable...

this is unstoppable...

... but let's do it right

OPEN WEB APIS

 

https://developer.mozilla.org/en-US/docs/WebAPI

HANDS-ON: my OWN SMS APP

Manifest:


{
"name": "My SMS app",
"description": "App to send SMS messages.",
"icons": {
"128": "/icons/SMS-icon.png"
},
"type": "certified",
"permissions": {
"sms": {}
}
}

HTML:


<input id="number" type="text" placeholder="666666666"> <br/>
<textarea id="text" placeholder="Type your text..."></textarea> <br/>
<button id="send"> Send </button>

Javascript:


var sms = navigator.mozMobileMessage;
sms.send(number.value, text.value);

web activities

SMS app manifest:


"activities": {
  "new": {
    "href": "/index.html#activity-new",
    "filters": {
      "type": "websms/sms",
      "number": {
        "pattern":"[\\w\\s+#*().-]{0,50}"
      }
     },
    "disposition": "inline",
    "returnValue": true
  }
}

Activity invocation code:


var activity = new MozActivity({
  name: 'new',
  data: {
    type: 'websms/sms',
    number: number
  }
});

Web APIs

By Germán Toro del Valle

Web APIs

Presentation about the new Web APIs being defined in the context of the Open Web Apps project (https://developer.mozilla.org/en-US/docs/Web/Apps).

  • 4,032