W3C at the Mobile Widget Camp Austin


Oh Widget, Where Art Thou?

Matt Womer, mdw@w3.org

Overview

The World Wide Web Consortium

Interactive Bit!

Me and W3C

Matt Womer: mdw@w3.org

Widgets @ W3C

What's a widget?

"A widget is an interactive single purpose application for displaying and/or updating local data or data on the Web, packaged in a way to allow a single download and installation on a user's machine or mobile device. A widget may run as a stand alone application (meaning it can run outside of a Web browser), or may be embedded into a Web document."

Widgets @ W3C

Web Applications Working Group

Co-chairs:

Team Contact: Doug Schepers

Widgets @ W3C

Requirements gathered in several areas:

The result?

Widgets @ W3C

Widgets 1.0 family of specifications

Follow http://twitter.com/widgetspecs

And what about location?

There are a lot of ways to obtain location information:

And if you're lucky enough to have a browser that can access location information, it's likely to not work with another browser...

So... what *are* you doing about location?

Creating a single Web API for accessing location information:

What can you do with this API?

Some uses:

Code!

“One-shot” query

function showMap(position) {
    // Show a map centered at
    // at (position.latitude, position.longitude). 
    // your code here!
}
// One-shot position request.
navigator.geolocation.getCurrentPosition(showMap);

Code!

Position updates

function scrollMap(position) {
  // Scrolls the map so it is centered
  // at (position.latitude, position.longitude). 
  // your code here!
}

// Request repeated updates.
var watchId = navigator.geolocation.watchPosition(scrollMap);
function buttonClickHandler() 
{
    // Cancel when user clicks button
    navigator.geolocation.clearWatch(watchId); 
}

The Nitty Gritty

IDL: Geolocation interface

  interface Geolocation { 
    readonly attribute Position lastPosition;
    void getCurrentPosition(in 
      PositionCallback successCallback);
    …
    int watchPosition(in
      PositionCallback successCallback);
    …
    void clearWatch(in int watchId); 
  };

The Nitty Gritty

IDL: PositionCallback interface

  interface PositionCallback {
    void handleEvent(in Position position); 
  };

The Nitty Gritty

IDL: Position object

  interface Position {
    readonly attribute double latitude;
    readonly attribute double longitude;
    readonly attribute double accuracy;
    readonly attribute double altitude;
    readonly attribute double altitudeAccuracy;
    readonly attribute double heading
    readonly attribute double velocity
    readonly attribute DOMTimeStamp timestamp; 
  };

Get Involved!

We're working in the public!

Questions?