ObservableProvider
JsonProvider
PollingProvider
| Package: | CQ.Ext.direct |
| Class: | PollingProvider |
| Extends: | CQ.Ext.direct.JsonProvider |
| Clientlib: | cq.widgets |
Provides for repetitive polling of the server at distinct intervals. The initial request for data originates from the client, and then is responded to by the server.
All configurations for the PollingProvider should be generated by the server-side API portion of the CQ.Ext.Direct stack.
An instance of PollingProvider may be created directly via the new keyword or by simply specifying type = 'polling'. For example:
var pollA = new CQ.Ext.direct.PollingProvider({
type:'polling',
url: 'php/pollA.php',
});
CQ.Ext.Direct.addProvider(pollA);
pollA.disconnect();
CQ.Ext.Direct.addProvider(
{
type:'polling',
url: 'php/pollB.php',
id: 'pollB-provider'
}
);
var pollB = CQ.Ext.Direct.getProvider('pollB-provider'); | Config Options | Defined By | |
|---|---|---|
|
baseParams : Object
An object containing properties which are to be sent as parameters on every polling request
|
PollingProvider | |
|
id : String The unique id of the provider (defaults to an auto-assigned id). You should assign an id if you need to be able to ac...
The unique id of the provider (defaults to an auto-assigned id). You should assign an id if you need to be able to access the provider later and you do not have an object reference available, for example:
|
Provider | |
|
interval : Number How often to poll the server-side in milliseconds (defaults to 3000 - every 3 seconds).
How often to poll the server-side in milliseconds (defaults to 3000 - every 3 seconds).
|
PollingProvider | |
|
priority : Number Priority of the request (defaults to 3). See CQ.Ext.direct.Provider.priority.
Priority of the request (defaults to 3). See CQ.Ext.direct.Provider.priority.
|
PollingProvider | |
|
type : String Required, undefined by default. The type of provider specified to CQ.Ext.Direct.addProvider to create a new Provider....
Required, undefined by default. The type of provider specified to CQ.Ext.Direct.addProvider to create a new Provider. Acceptable values by default are:
|
Provider | |
|
url : String/Function The url which the PollingProvider should contact with each request. This can also be an imported CQ.Ext.Direct method...
The url which the PollingProvider should contact with each request. This can also be an imported CQ.Ext.Direct method which will accept the baseParams as its only argument.
|
PollingProvider | |
| Property | Defined By | |
|---|---|---|
|
connect : Object
Abstract methods for subclasses to implement.
|
Provider | |
|
disconnect : Object
Abstract methods for subclasses to implement.
|
Provider | |
| Method | Defined By | |
|---|---|---|
|
connect() : void Connect to the server-side and begin the polling process. To handle each
response subscribe to the data event.
Connect to the server-side and begin the polling process. To handle each
response subscribe to the data event.
Parameters:
|
PollingProvider | |
|
disconnect() : void Disconnect from the server-side and stop the polling process. The disconnect
event will be fired on a successful disc...
Disconnect from the server-side and stop the polling process. The disconnect
event will be fired on a successful disconnect.
Parameters:
|
PollingProvider | |
enableBubble( String/Array events ) : void Enables events fired by this Observable to bubble up an owner hierarchy by calling
this.getBubbleTarget() if present....
Enables events fired by this Observable to bubble up an owner hierarchy by calling
This is commonly used by CQ.Ext.Components to bubble events to owner Containers. See CQ.Ext.Component.getBubbleTarget. The default implementation in CQ.Ext.Component returns the Component's immediate owner. But if a known target is required, this can be overridden to access the required target more quickly. Example:
Parameters:
|
Observable | |
|
isConnected() : void Returns whether or not the server-side is currently connected.
Abstract method for subclasses to implement.
Returns whether or not the server-side is currently connected.
Abstract method for subclasses to implement.
Parameters:
|
Provider | |
relayEvents( Object o, Array events ) : void Relays selected events from the specified Observable as if the events were fired by this.
Relays selected events from the specified Observable as if the events were fired by this.
Parameters:
|
Observable | |
| Event | Defined By | |
|---|---|---|
beforepoll : ( CQ.Ext.direct.PollingProvider ) Fired immediately before a poll takes place, an event handler can return false
in order to cancel the poll.
Fired immediately before a poll takes place, an event handler can return false
in order to cancel the poll.
Listeners will be called with the following arguments:
|
PollingProvider | |
connect : ( CQ.Ext.direct.Provider provider ) Fires when the Provider connects to the server-side
Fires when the Provider connects to the server-side
Listeners will be called with the following arguments:
|
Provider | |
data : ( CQ.Ext.direct.Provider provider, event e ) Fires when the Provider receives data from the server-side
Fires when the Provider receives data from the server-side
Listeners will be called with the following arguments:
|
Provider | |
disconnect : ( CQ.Ext.direct.Provider provider ) Fires when the Provider disconnects from the server-side
Fires when the Provider disconnects from the server-side
Listeners will be called with the following arguments:
|
Provider | |
|
exception : () Fires when the Provider receives an exception from the server-side
Fires when the Provider receives an exception from the server-side
Listeners will be called with the following arguments:
|
Provider | |
poll : ( CQ.Ext.direct.PollingProvider ) This event has not yet been implemented.
This event has not yet been implemented.
Listeners will be called with the following arguments:
|
PollingProvider | |