vegui. sk. bridge.js

Summary
allows you do specify which domain to use for all requests sent with the bridge, default: ‘’
VegUI xml request object
constructor
Removes a request from the list
This function will be called on successful response to request if the VegUIRequest’s pFunc property is not set.
Spawns a new XMLHttpRequest object and returns it in the form of a VegUIRequest object
triggered when the maximum number of timeouts is reched
triggered everytime a request times out, submits the timed out request as a parameter
Polls the Request array for any timed out requests and handles them arcordingly.
When a request gets a response from the server then it will go through this function where it will determine if it was a successful request or not
send a request to the server

Constants

VUI_URL

allows you do specify which domain to use for all requests sent with the bridge, default: ‘’

VegUIRequest

VegUI xml request object

Properties

Object Properties

timeCreationint, time of creation
timeSendint, time it took to send and get a request
requestXMLHttpRequest, the xml http request object
toElementVegUIElement, request belongs to this element
processfunction, if set this function will be executed when the request has been responded to by the server
idint, unique request id

Functions

VegUIRequest

function VegUIRequest(req,
id,
toElement)

constructor

Parameters

XMLHttpRequest reqthe xml http request object
int idthe unique request id
<VegUIElement toElement>flags this request as belong to the submitted element

VegUIBridge

Allows clientserver communication
Summary
Removes a request from the list
This function will be called on successful response to request if the VegUIRequest’s pFunc property is not set.
Spawns a new XMLHttpRequest object and returns it in the form of a VegUIRequest object
triggered when the maximum number of timeouts is reched
triggered everytime a request times out, submits the timed out request as a parameter
Polls the Request array for any timed out requests and handles them arcordingly.
When a request gets a response from the server then it will go through this function where it will determine if it was a successful request or not
send a request to the server

Properties

Object Properties

maxSendTimeint, maximum time a request can take before timing out
maxTimeoutsint, maximum number of timeouts before onmaxtimeouts is called
conTimeoutsint, current timeouts in a row
sendNumint, number of requests sent
timeoutNumint, total number of timeouts
successNumint, total number of successful requests
PTimerInterval, the interval object that polls timeouts
denyRequests*bool’, if true no requests can be sent
resendbool, if true failed requests will be resent
Request, RArray, holds all active requests

Functions

cleanup

this.cleanup = function(vreq)

Removes a request from the list

Parameters

VegUIRequest vreqrequest to be removed

execute

this.execute = function(vreq)

This function will be called on successful response to request if the VegUIRequest’s pFunc property is not set.  Be aware that you may overwrite the execute methid with your own by simply redefining it

Parameters

VegUIRequest vreqthe request that was successful

Returns

booltrue

new_request

this.new_request = function(toElement)

Spawns a new XMLHttpRequest object and returns it in the form of a VegUIRequest object

Parameters

<VegUIElement toElement>if set the request will be flagged to belong to the submitted element

onmaxtimeouts

triggered when the maximum number of timeouts is reched

ontimeout

triggered everytime a request times out, submits the timed out request as a parameter

poll_timeouts

this.poll_timeouts = function()

Polls the Request array for any timed out requests and handles them arcordingly.  May call onmaxtimeouts and ontimeout

process_request

this.process_request = function(vreq)

When a request gets a response from the server then it will go through this function where it will determine if it was a successful request or not

Parameters

VegUIRequest vreqthe request object

send

this.send = function(url,
para,
method,
pFunc,
sync)

send a request to the server

Parameters

string urlurl or relative path to send the request to
<string para>url parameter string
<string method>method to use
<function pFunc>custom process function that will be executed when the request was returned successfully
<bool sync>if true the request will be async to the execution of the script, allowing the execution to continue while the request is sent.  True by default.

See also

<process>

valid_id

this.valid_id = function()

Returns

intvalid request id
function VegUIRequest(req,
id,
toElement)
constructor
this.cleanup = function(vreq)
Removes a request from the list
this.execute = function(vreq)
This function will be called on successful response to request if the VegUIRequest’s pFunc property is not set.
VegUI xml request object
this.new_request = function(toElement)
Spawns a new XMLHttpRequest object and returns it in the form of a VegUIRequest object
this.poll_timeouts = function()
Polls the Request array for any timed out requests and handles them arcordingly.
this.process_request = function(vreq)
When a request gets a response from the server then it will go through this function where it will determine if it was a successful request or not
this.send = function(url,
para,
method,
pFunc,
sync)
send a request to the server
this.valid_id = function()
triggered when the maximum number of timeouts is reched
triggered everytime a request times out, submits the timed out request as a parameter