~ubuntu-branches/ubuntu/raring/maas/raring-updates

« back to all changes in this revision

Viewing changes to src/maasserver/static/jslibs/yui/3.4.1/docs/datasource/datasource-polling.html

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2012-07-03 17:42:37 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20120703174237-p8l0keuuznfg721k
Tags: 0.1+bzr709+dfsg-0ubuntu1
* New Upstream release
* debian/control:
  - Depends on python-celery, python-tempita, libjs-yui3-{full,min},
    libjs-raphael
* debian/maas.install:
  - Install apiclient, celeryconfig.py, maas-import-pxe-files, preseeds_v2.
  - Update to install various files from chroot, rather tha manually copy
    them from the source.
* debian/maas.links: symlink celeryconfig.py
* debian/maas.maas-celery.upstart: Add job.
* debian/rules:
  - Install celery upstart job.
  - Do not install jslibs as packages are now used.
  - Drop copying of maas_local_settings_sample.py as source now ships
    a maas_local_settings.py
* debian/patches:
  - 04-maas-http-fix.patch: Drop. Merged upstream.
  - 01-fix-database-settings.patch: Refreshed.
  - 99_enums_js.patch: Added until creation of enum.js / build process
    is fixed.
* debian/maas.postinst: Update bzr version to correctly handle upgrades.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE html>
2
 
<html lang="en">
3
 
<head>
4
 
    <meta charset="utf-8">
5
 
    <title>Example: DataSource with Polling</title>
6
 
    <link rel="stylesheet" href="http://yui.yahooapis.com/3.4.0pr3/build/cssgrids/grids-min.css">
7
 
    <link rel="stylesheet" href="../assets/css/main.css">
8
 
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
9
 
    <script src="../../build/yui/yui-min.js"></script>
10
 
</head>
11
 
<body>
12
 
 
13
 
<div id="doc">
14
 
    <h1>Example: DataSource with Polling</h1>
15
 
 
16
 
    
17
 
 
18
 
    <div class="yui3-g">
19
 
        <div id="main" class="yui3-u">
20
 
            <div class="content"><style scoped>
21
 
/* custom styles for this example */
22
 
#demo .output {margin-bottom:1em; padding:10px; border:1px solid #D9D9D9;}
23
 
</style>
24
 
 
25
 
<div class="intro">
26
 
    <p>DataSource's Pollable extension enables polling functionality on all your DataSource instances.</p>
27
 
</div>
28
 
 
29
 
<div class="example yui3-skin-sam">
30
 
    <form id="demo">
31
 
    <h6>Poll every second for current time:</h6>
32
 
    <input type="button" id="demo_enable" value="Start polling">
33
 
    <input type="button" id="demo_disable" value="End polling">
34
 
    <div id="demo_output_polling" class="output"></div>
35
 
</form>
36
 
 
37
 
<script type="text/javascript">
38
 
YUI().use("dump", "node", "datasource-function", "datasource-polling", function (Y) {
39
 
    var id,
40
 
        myFunction = function() {
41
 
            return new Date();
42
 
        },
43
 
        myDataSource = new Y.DataSource.Function({source:myFunction}),
44
 
        request = {
45
 
            callback: {
46
 
                success: function(e){
47
 
                    Y.one("#demo_output_polling")
48
 
                     .setContent("At the tone the time will be: " +
49
 
                                Y.dump(e.response.results[0].toString()));
50
 
                },
51
 
                failure: function(e){
52
 
                    Y.one("#demo_output_polling")
53
 
                     .setContent("Could not retrieve data: " + e.error.message);
54
 
                }
55
 
            }
56
 
        };
57
 
 
58
 
    Y.on("click", function(e){
59
 
        if(id) {
60
 
            myDataSource.clearInterval(id);
61
 
        }
62
 
        id = myDataSource.setInterval(1000, request);
63
 
    }, "#demo_enable");
64
 
 
65
 
    Y.on("click", function(e){
66
 
        myDataSource.clearInterval(id);
67
 
    }, "#demo_disable");
68
 
});
69
 
</script>
70
 
 
71
 
</div>
72
 
 
73
 
<p>Include the <code>datasource-pollable</code> extension in your <code>Y.use()</code> statement to add the <code>setInterval()</code>, <code>clearInterval()</code>, and <code>clearAllInterval()</code> methods to all your DataSource instances.</p>
74
 
 
75
 
<pre class="code prettyprint">YUI().use(&quot;datasource-function&quot;, &quot;datasource-polling&quot;, function(Y) {
76
 
    var myFunction = function() {
77
 
            return new Date();
78
 
        },
79
 
        myDataSource = new Y.DataSource.Function({source:myFunction}),
80
 
        request = {
81
 
            callback: {
82
 
                success: function(e){
83
 
                    Y.one(&quot;#demo_output_polling&quot;)
84
 
                     .setContent(&quot;At the tone the time will be: &quot; +
85
 
                                Y.dump(e.response.results[0].toString()));
86
 
                },
87
 
                failure: function(e){
88
 
                    Y.one(&quot;#demo_output_polling&quot;)
89
 
                     .setContent(&quot;Could not retrieve data: &quot; + e.error.message);
90
 
                }
91
 
            }
92
 
        },
93
 
        id = myDataSource.setInterval(1000, request); &#x2F;&#x2F; Starts polling
94
 
 
95
 
        myDataSource.clearInterval(id); &#x2F;&#x2F; Ends polling
96
 
});</pre>
97
 
 
98
 
</div>
99
 
        </div>
100
 
 
101
 
        <div id="sidebar" class="yui3-u">
102
 
            
103
 
 
104
 
            
105
 
                <div class="sidebox">
106
 
                    <div class="hd">
107
 
                        <h2 class="no-toc">Examples</h2>
108
 
                    </div>
109
 
 
110
 
                    <div class="bd">
111
 
                        <ul class="examples">
112
 
                            
113
 
                                
114
 
                                    <li data-description="The Local DataSource manages retrieval of in-page data, from JavaScript arrays and objects to DOM elements.">
115
 
                                        <a href="datasource-local.html">DataSource.Local</a>
116
 
                                    </li>
117
 
                                
118
 
                            
119
 
                                
120
 
                                    <li data-description="The Get DataSource, which manages retrieval of data from remote sources via the Get Utility, can be useful for accessing data from cross-domain servers without the need for a proxy.">
121
 
                                        <a href="datasource-get.html">DataSource.Get</a>
122
 
                                    </li>
123
 
                                
124
 
                            
125
 
                                
126
 
                                    <li data-description="The IO DataSource manages retrieval of data from remote sources, via the IO Utility.">
127
 
                                        <a href="datasource-io.html">DataSource.IO</a>
128
 
                                    </li>
129
 
                                
130
 
                            
131
 
                                
132
 
                                    <li data-description="The Function DataSource, which manages retrieval of data from a JavaScript function, provides a highly customizeable mechanism for implementer-defined data retrieval algorithms">
133
 
                                        <a href="datasource-function.html">DataSource.Function</a>
134
 
                                    </li>
135
 
                                
136
 
                            
137
 
                                
138
 
                                    <li data-description="Use the DataSourceCache plugin to enable caching and reduce server calls to remote sources.">
139
 
                                        <a href="datasource-caching.html">DataSource with Caching</a>
140
 
                                    </li>
141
 
                                
142
 
                            
143
 
                                
144
 
                                    <li data-description="The DataSourceCache plugin supports offline caching so that cached data persists across browser sessions.">
145
 
                                        <a href="datasource-offlinecache.html">DataSource with Offline Cache</a>
146
 
                                    </li>
147
 
                                
148
 
                            
149
 
                                
150
 
                                    <li data-description="Use the Pollable extension to enable polling in your DataSource.">
151
 
                                        <a href="datasource-polling.html">DataSource with Polling</a>
152
 
                                    </li>
153
 
                                
154
 
                            
155
 
                                
156
 
                            
157
 
                        </ul>
158
 
                    </div>
159
 
                </div>
160
 
            
161
 
 
162
 
            
163
 
                <div class="sidebox">
164
 
                    <div class="hd">
165
 
                        <h2 class="no-toc">Examples That Use This Component</h2>
166
 
                    </div>
167
 
 
168
 
                    <div class="bd">
169
 
                        <ul class="examples">
170
 
                            
171
 
                                
172
 
                            
173
 
                                
174
 
                            
175
 
                                
176
 
                            
177
 
                                
178
 
                            
179
 
                                
180
 
                            
181
 
                                
182
 
                            
183
 
                                
184
 
                            
185
 
                                
186
 
                                    <li data-description="How to provide autocomplete suggestions using a DataSource instance.">
187
 
                                        <a href="../autocomplete/ac-datasource.html">Remote Data via DataSource</a>
188
 
                                    </li>
189
 
                                
190
 
                            
191
 
                        </ul>
192
 
                    </div>
193
 
                </div>
194
 
            
195
 
        </div>
196
 
    </div>
197
 
</div>
198
 
 
199
 
<script src="../assets/vendor/prettify/prettify-min.js"></script>
200
 
<script>prettyPrint();</script>
201
 
 
202
 
</body>
203
 
</html>