Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / docs / source / Provider.html
1 <!DOCTYPE html><html><head><title>Sencha Documentation Project</title><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../prettify.css" type="text/css"><link rel="stylesheet" href="../prettify_sa.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script></head><body onload="prettyPrint()"><pre class="prettyprint"><pre><span id='Ext-direct.Provider'>/**
2 </span> * @class Ext.direct.Provider
3  * &lt;p&gt;Ext.direct.Provider is an abstract class meant to be extended.&lt;/p&gt;
4  * 
5  * &lt;p&gt;For example ExtJs implements the following subclasses:&lt;/p&gt;
6  * &lt;pre&gt;&lt;code&gt;
7 Provider
8 |
9 +---{@link Ext.direct.JsonProvider JsonProvider} 
10     |
11     +---{@link Ext.direct.PollingProvider PollingProvider}   
12     |
13     +---{@link Ext.direct.RemotingProvider RemotingProvider}   
14  * &lt;/code&gt;&lt;/pre&gt;
15  * @abstract
16  */
17 Ext.define('Ext.direct.Provider', {
18     
19     /* Begin Definitions */
20    
21    alias: 'direct.provider',
22    
23     mixins: {
24         observable: 'Ext.util.Observable'   
25     },
26    
27     /* End Definitions */
28    
29 <span id='Ext-direct.Provider-cfg-id'>   /**
30 </span>     * @cfg {String} id
31      * The unique id of the provider (defaults to an {@link Ext#id auto-assigned id}).
32      * You should assign an id if you need to be able to access the provider later and you do
33      * not have an object reference available, for example:
34      * &lt;pre&gt;&lt;code&gt;
35 Ext.direct.Manager.addProvider({
36     type: 'polling',
37     url:  'php/poll.php',
38     id:   'poll-provider'
39 });     
40 var p = {@link Ext.direct.Manager}.{@link Ext.direct.Manager#getProvider getProvider}('poll-provider');
41 p.disconnect();
42      * &lt;/code&gt;&lt;/pre&gt;
43      */
44     
45     constructor : function(config){
46         var me = this;
47         
48         Ext.apply(me, config);
49         me.addEvents(
50 <span id='Ext-direct.Provider-event-connect'>            /**
51 </span>             * @event connect
52              * Fires when the Provider connects to the server-side
53              * @param {Ext.direct.Provider} provider The {@link Ext.direct.Provider Provider}.
54              */            
55             'connect',
56 <span id='Ext-direct.Provider-event-disconnect'>            /**
57 </span>             * @event disconnect
58              * Fires when the Provider disconnects from the server-side
59              * @param {Ext.direct.Provider} provider The {@link Ext.direct.Provider Provider}.
60              */            
61             'disconnect',
62 <span id='Ext-direct.Provider-event-data'>            /**
63 </span>             * @event data
64              * Fires when the Provider receives data from the server-side
65              * @param {Ext.direct.Provider} provider The {@link Ext.direct.Provider Provider}.
66              * @param {event} e The Ext.Direct.Event type that occurred.
67              */            
68             'data',
69 <span id='Ext-direct.Provider-event-exception'>            /**
70 </span>             * @event exception
71              * Fires when the Provider receives an exception from the server-side
72              */                        
73             'exception'
74         );
75         me.mixins.observable.constructor.call(me, config);
76     },
77     
78 <span id='Ext-direct.Provider-method-isConnected'>    /**
79 </span>     * Returns whether or not the server-side is currently connected.
80      * Abstract method for subclasses to implement.
81      */
82     isConnected: function(){
83         return false;
84     },
85
86 <span id='Ext-direct.Provider-property-connect'>    /**
87 </span>     * Abstract methods for subclasses to implement.
88      */
89     connect: Ext.emptyFn,
90     
91 <span id='Ext-direct.Provider-property-disconnect'>    /**
92 </span>     * Abstract methods for subclasses to implement.
93      */
94     disconnect: Ext.emptyFn
95 });
96 </pre></pre></body></html>