COMM

Description

XMLHttpRequest abstractor, and handler and utilities. The only public method is request The namespace also holds the following services:

Service Name Service Description
COMM.Queue Singleton, used for queuing tasks awaiting asynchronous requests to complete.
COMM.Session Session key secure hashing service.
COMM.SessionWatcher Polls server at regular intervals by reporting the client's local time.
COMM.Transporter Automated synchronization service, pulls server data, tasks etc. The main server interface.
COMM.Values Data value manager, handles synchronized data in both directions (server-client-server).
COMM.JSLoader Loads Javascript libraries asynchronously.
COMM.JSONRenderer Constructs nodes from JSON structures as GUI tree structures. Lowers the learning curve of GUI development, because Javascript knowledge is not required to define user interfaces. The main purpose is to ease the development of user interfaces by defining them as data on the server, converting the data to JSON GUI trees and letting the client handle the rest. The end result is the same as defining the structures in JavaScript code.

request( url, options )

Description

The main Request-handling object. Provides a general and fairly easy to use interface for making "Ajax" requests.

Parameters

url Full or relative url of the response handler
options An Object, see below for content:

Required properties for options:

onSuccess A function that is called on a successful response. Must accept one parameter: the request object.
onFailure A function that is called on an unsuccessful response. Must accept one parameter: the request object.

Optional properties for options:

method The HTTP Request Method, usually 'POST' or 'GET', but will handle DAV and other extensions if the server supports them. Defaults to 'POST'.
async Boolean; Uses asyncronous requests when true. Defaults to true.
params Extra parameters to send, format: Array, see COMM.arrayToQueryString()
headers Extra HTTP headers to send for POST requests, format: Hash.
body The HTTP POST Body
username Username for basic authentication
password Password for basic authentication
contentType The 'content-type' -header to send. Defaults to 'application/x-www-form-urlencoded'.
charset The charset type to use. Defaults to 'UTF-8'.

Returns

An Object extended from the options given in the input.