Eric Ferraiuolo![]()
Use just like regular Y.io, but the first parameter is the number of milliseconds to continually xhr-poll at. A new callback method/event has been added, 'modified', which will only be called when the server resource sends a 200 OK response.
The IO config object (third parameter to Y.io.poll) is just like, Y.io's config object; but a new on: { modified: function(txId, r, args){ /* your callback code here */ } } callback/event is added.
This will smartly poll the server using conditional GET requests (when method is set to GET).
Blog post on smart polling: http://925html.com/code/smart-polling/
<script src="http://yui.yahooapis.com/3.0.0/build/yui/yui-min.js"></script>YUI({
//Last Gallery Build of this module
gallery: 'gallery-2009.11.19-20'
}).use('gallery-io-poller', function(Y) {
var resource = Y.io.poll(5000, 'path/to/resource/', {
on : {
modified : function (txId, r, args) {
// the resource has been modified
}
}
});
resource.start();
});| Subject | Author | Date |
|---|---|---|
| Awesome utility! | Jacob Fogg | 03/24/10 |
| Re: Awesome utility! | Eric Ferraiuolo | 03/25/10 |
| IE treats the server response as 304 | Colin Yates | 11/10/11 |
| Re: IE treats the server response as 304 | Colin Yates | 11/10/11 |
| Why are ioConfig and uri writeonce attributes? | Iliyan Peychev | 05/5/12 |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info