Class o2.JsonpController

Extends o2.AjaxController

A JSONP Controller. Registers itself to JsonpState Observable upon construction.

Implements the Observer interface.


class o2.JsonpController
Defined in jsonpcontroller

Constructor Summary
JsonpController (String jsonp, Object args)
See http://download.oracle.com/javase/1.4.2/docs/api/java/util/Observer.html

Usage example:

 var jsonp = o2.Jsonp.get('http://example.com/api.php', handleResponse);
 var controller = new o2.JsonpController(jsonp, {timeout: 5000});
 

Function Summary
override unregister()

Overrides o2.AjaxController.unregister.

Unregisters this object from its associated observable. (i.e. JsonpState)

Usage example:

 controller.unregister();
 
override update (JsonpState observable, Object data)

Overrides o2.AjaxController.update.

Usage example:

 controller.update({isTimedOut : true});
 

Constructor Details

constructor JsonpController

JsonpController(String jsonp, Object args)
See http://download.oracle.com/javase/1.4.2/docs/api/java/util/Observer.html

Usage example:

 var jsonp = o2.Jsonp.get('http://example.com/api.php', handleResponse);
 var controller = new o2.JsonpController(jsonp, {timeout: 5000});
 
Parameters:
jsonp - the current jsonp unique identifier.
args - an associative array in the form {timeout:[timeoutInMilliSeconds], ontimeout: [function]} both attributes are optional.

Function Details

function unregister

override unregister()

Overrides o2.AjaxController.unregister.

Unregisters this object from its associated observable. (i.e. JsonpState)

Usage example:

 controller.unregister();
 

function update

override update(JsonpState observable, Object data)

Overrides o2.AjaxController.update.

Usage example:

 controller.update({isTimedOut : true});
 
Parameters:
observable - the Observable state object.
data - parameters passed from the Observable to this Observer.