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/
YUI({
modules: {
'gallery-io-poller': {
fullpath: 'http://yui.yahooapis.com/gallery-2009.11.19-20/build/gallery-io-poller/gallery-io-poller-min.js',
requires: ['io-base','base-base'],
optional: [],
supersedes: []
}
}
}).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();
});No forum posts for this module.
© 2010 YUI Library - Site Credits