Class: HttpService

conbo.HttpService(options)

new HttpService(options)

HTTP Service Base class for HTTP data services, with default configuration designed for use with JSON REST APIs. For XML data sources, you will need to override decodeFunction to parse response data, change the contentType and implement encodeFunction if you're using RPC.
Parameters:
Name Type Description
options Object Object containing optional initialisation options, including 'rootUrl', 'contentType', 'dataType', 'headers', 'encodeFunction', 'decodeFunction', 'resultClass','makeObjectsBindable'
Author:
  • Neil Rackett
Source:
Fires:

Extends

Members

rootUrl

The root URL of the web service
Source:

supro

Similar to `super` in ActionScript or Java, this property enables you to access properties and methods of the super class prototype, which is the case of JavaScript is the next prototype up the chain
Inherited From:
Source:

Methods

addCommand(command, methodopt, resultClassopt)

Add one or more remote commands as methods of this class instance
Parameters:
Name Type Attributes Default Description
command string The name of the command
method string <optional>
GET GET, POST, etc (default: GET)
resultClass Class <optional>
Optional
Source:

addCommands(commands)

Add multiple commands as methods of this class instance
Parameters:
Name Type Description
commands Array.<string>
Source:

addEventListener(type, handler, scopeopt, priorityopt, onceopt) → {conbo.EventDispatcher}

Add a listener for a particular event type
Parameters:
Name Type Attributes Default Description
type string Type of event ('change') or events ('change blur')
handler function Function that should be called
scope Object <optional>
Options object (recommended) or the scope in which to run the event handler (deprecated)
priority number <optional>
0 The event handler's priority when the event is dispatached (deprecated)
once boolean <optional>
false Should the event listener automatically be removed after it has been called once? (deprecated)
Inherited From:
Source:
Returns:
A reference to this class instance
Type
conbo.EventDispatcher

bindAll(…methodNameopt) → {this}

Scope all methods of this class instance to this class instance
Parameters:
Name Type Attributes Description
methodName string <optional>
<repeatable>
Specific method names to bind (all will be bound if none specified)
Inherited From:
Source:
Returns:
Type
this

call(command, dataopt, methodopt, resultClassopt) → {Promise}

Call a method of the web service using the specified verb
Parameters:
Name Type Attributes Default Description
command string The name of the command
data Object <optional>
Object containing the data to send to the web service
method string <optional>
GET GET, POST, etc (default: GET)
resultClass Class <optional>
Optional
Source:
Returns:
Type
Promise

declarations() → {void}

Declarations is used to declare instance properties used by this class
Parameters:
Type Attributes Description
* <repeatable>
Inherited From:
Source:
Returns:
Type
void

delete(command, dataopt, resultClassopt) → {Promise}

Call a method of the web service using the DELETE verb
Parameters:
Name Type Attributes Description
command string The name of the command
data Object <optional>
Object containing the data to send to the web service
resultClass Class <optional>
Optional
Source:
Returns:
Type
Promise

destroy() → {void}

Clean everything up ready for garbage collection (you should override in your own classes)
Inherited From:
Source:
Returns:
Type
void

dispatchChange(propName) → {conbo.EventDispatcher}

Dispatch a change event for one or more changed properties
Parameters:
Name Type Description
propName string The name of the property that has changed
Inherited From:
Source:
Returns:
A reference to this class instance
Type
conbo.EventDispatcher

dispatchEvent(event) → {conbo.EventDispatcher}

Dispatch the event to listeners
Parameters:
Name Type Description
event conbo.Event The event to dispatch
Inherited From:
Source:
Returns:
A reference to this class instance
Type
conbo.EventDispatcher

encodeFunction(data, methodopt)

Method that encodes data to be sent to the API
Parameters:
Name Type Attributes Default Description
data Object Object containing the data to be sent to the API
method string <optional>
GET GET, POST, etc (default: GET)
Source:

get(command, dataopt, resultClassopt) → {Promise}

Call a method of the web service using the GET verb
Parameters:
Name Type Attributes Description
command string The name of the command
data Object <optional>
Object containing the data to send to the web service
resultClass Class <optional>
Optional
Source:
Returns:
Type
Promise

hasEventListener(type, handleropt, scopeopt) → {boolean}

Does this object have an event listener of the specified type?
Parameters:
Name Type Attributes Description
type string Type of event (e.g. 'change')
handler function <optional>
Function that should be called
scope Object <optional>
Options object (recommended) or the scope in which to run the event handler (deprecated)
Inherited From:
Source:
Returns:
True if this object has the specified event listener, false if it does not
Type
boolean

initialize() → {void}

Initialize (entry point) is called immediately after the constructor has completed
Parameters:
Type Attributes Description
* <repeatable>
Inherited From:
Source:
Returns:
Type
void

parseUrl()

Splice data into URL and remove spliced properties from data object
Source:

patch(command, dataopt, resultClassopt) → {Promise}

Call a method of the web service using the PATCH verb
Parameters:
Name Type Attributes Description
command string The name of the command
data Object <optional>
Object containing the data to send to the web service
resultClass Class <optional>
Optional
Source:
Returns:
Type
Promise

post(command, dataopt, resultClassopt) → {Promise}

Call a method of the web service using the POST verb
Parameters:
Name Type Attributes Description
command string The name of the command
data Object <optional>
Object containing the data to send to the web service
resultClass Class <optional>
Optional
Source:
Returns:
Type
Promise

preinitialize() → {void}

Preinitialize is called before any code in the constructor has been run
Parameters:
Type Attributes Description
* <repeatable>
Inherited From:
Source:
Returns:
Type
void

put(command, dataopt, resultClassopt) → {Promise}

Call a method of the web service using the PUT verb
Parameters:
Name Type Attributes Description
command string The name of the command
data Object <optional>
Object containing the data to send to the web service
resultClass Class <optional>
Optional
Source:
Returns:
Type
Promise

removeEventListener(typeopt, handleropt, scopeopt) → {conbo.EventDispatcher}

Remove a listener for a particular event type
Parameters:
Name Type Attributes Description
type string <optional>
Type of event ('change') or events ('change blur'), if not specified, all listeners will be removed
handler function <optional>
Function that should be called, if not specified, all listeners of the specified type will be removed
scope Object <optional>
Options object (recommended) or the scope in which to run the event handler (deprecated)
Inherited From:
Source:
Returns:
A reference to this class instance
Type
conbo.EventDispatcher

toString() → {string}

String representation of the current class
Overrides:
Source:
Returns:
Type
string