XHRFactory.CreateXHR
Implementation : Function
Description : Creates an XMLHTTPRequest object
Signature : CreateXHR ()
Parameters : None
Returns : A reference to an XMLHTTPRequest object
Notes : Calling this function simply creates an XMLHTTPRequest object that is
appropriate to the browser on which the application is running. It
is the responsibility of any client code that calls this function
to assign any event handlers to the object returned, as well as to
call the open and send methods. Moreover, using this function
means that the response handler must check the values of the
readyState and status members of the XMLHTTPRequest object itself.
Given that the DoTxn method of the XHRWrapper type manages
all of these details, there is normally no need to use this function.
XHRFactory.CreateXHRWrapper
Implementation : Function
Description : Creates an XHRWrapper object.
Signature : CreateXHRWrapper ()
Parameters : None
Returns : A reference to an XHRWrapper object.
Notes : See the XHRWrapper API for details of the attribute and
method that XHRWrappers support.
XHRWrapper.Abort
Implementation : Function
Description : Stops a partially compeleted transaction with the server.
Signature : Abort ()
Parameters : None
Returns : Nothing
Notes : Calling this function is a safe way of aborting a transaction,
in that it ensures that the client-code response handler is
not invoked, as happens on certain Gecko-based platforms. Other
than that, it has the same effect as calling the underlying XHR
object's abort method.
XHRWrapper.DoTxn
Implementation : Function
Description : Creates and initialises an XMLHTTPRequest object, then calls its
open and send methods.
Signature : DoTxn (Method, URL, Async, Data, ResponseHandler, Mimetype, ErrorHandler)
Parameters : URL - String describing the URL of the server-side
process with which the client wishes to
communicate.
Method - String describing an HTTP method (e.g. 'GET' or
'POST').
ASync - Boolean. True denotes an asychronous request,
false denotes synchronous.
Data - String describing the data, if any, to be sent
to the server. Must be an empty string or null
if there is no data to send.
Mimetype - String denoting the mimetype of the data.
ResponseHandler - Reference to a user-defined response-handler
function.
ErrorHandler - Reference to a user-defined error-handler
function.
Returns : A reference to the XMLHTTPRequest object.
Notes : Non-Microsoft browsers implement methods for XMLHTTPRequest
objects, such as onload, onerror and onprogress, as well as
methods for event listener manipulation. Should client code need
to avail itself of these methods then the code in DoTXN will
need to be adapted on a proprietary basis.
The ResponseHandler parameter must refer to a function that
accepts a single parameter, which is a reference to the
XMLHTTPRequest object that invoked the response handler. What
the response handler does when invoked is entirely specific to
the application, although there is no need for the function
to test the readyState and status attributes of the
XMLHTTPRequest object, as the response handler will be
invoked only if the transaction has completed successfully.
The ErrorHandler parameter must refer to a function that accepts
a single parameter, which is a reference to the XMLHTTPRequest
object that invoked the error handler. What the error handler
does when invoked is entirely specific to the application.
XHRWrapper.XHRObj
Implementation : Attribute
Description : This attribute corresponds to the XMLHTTPRequest object that is
created on a call to XHRFactory.CreateXHRWrapper.
Notes : Client code can use the XMLHTTPRequest object in exactly the same
fashion as any other XMLHTTPRequest object.