In the options argument you have the following options
(http://www.sergiopereira.com/articles/prototype.js.html ) and you will want to
use Ajax.PeriodicalUpdater w/ the last options:
The options argument object
An important part of the AJAX operations is the options argument. There's no
options class per se. Any object can be passed, as long as it has the expected
properties. It is common to create anonymous objects just for the AJAX calls.
Property Type Default Description
method String 'post' Method of the HTTP request
parameters String '' The url-formatted list of values passed to the
request
asynchronous Boolean true Indicates if the AJAX call will be made
asynchronously
postBody String undefined Content passed to in the request's body
in case of a HTTP POST
requestHeaders Array undefined List of HTTP headers to be passed with
the request. This list must have an even number of items, any odd item is the
name of a custom header, and the following even item is the string value of
that header. Example:['my-header1', 'this is the value', 'my-other-header',
'another value']
onXXXXXXXX Function(XMLHttpRequest, Object) undefined Custom
function to be called when the respective event/status is reached during the
AJAX call. Example var myOpts = {onComplete: showResponse, onLoaded:
registerLoaded};. The function used will receive one argument, containing the
XMLHttpRequest object that is carrying the AJAX operation and another argument
containing the evaluated X-JSON response HTTP header.
onSuccess Function(XMLHttpRequest, Object) undefined Custom
function to be called when the AJAX call completes successfully. The function
used will receive one argument, containing the XMLHttpRequest object that is
carrying the AJAX operation and another argument containing the evaluated
X-JSON response HTTP header.
onFailure Function(XMLHttpRequest, Object) undefined Custom
function to be called when the AJAX call completes with error. The function
used will receive one argument, containing the XMLHttpRequest object that is
carrying the AJAX operation and another argument containing the evaluated
X-JSON response HTTP header.
onException Function(Ajax.Request, exception) undefined Custom
function to be called when an exceptional condition happens on the client side
of the AJAX call, like an invalid response or invalid arguments. The function
used will receive two arguments, containing the Ajax.Request object that wraps
the AJAX operation and the exception object.
insertion an Insertion class undefined A class that will
determine how the new content will be inserted. It can be Insertion.Before,
Insertion.Top, Insertion.Bottom, or Insertion.After. Applies only to
Ajax.Updater objects.
evalScripts Boolean undefined, false Determines if script blocks
will be evaluated when the response arrives. Applies only to Ajax.Updater
objects.
decay Number undefined, 1 Determines the progressive slowdown in a
Ajax.PeriodicalUpdater object refresh rate when the received response is the
same as the last one. For example, if you use 2, after one of the refreshes
produces the same result as the previous one, the object will wait twice as
much time for the next refresh. If it repeats again, the object will wait four
times as much, and so on. Leave it undefined or use 1 to avoid the slowdown.
frequency Number undefined, 2 Interval (not frequency) between
refreshes, in seconds. Applies only to Ajax.PeriodicalUpdater objects.
var myUpdater = new Ajax.PeriodicalUpdater( $('itemId'), url, {frequency:1} );
-Andrew Martinez
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mark McCray
Sent: Tuesday, May 23, 2006 2:20 PM
To: [email protected]
Subject: [Rails-spinoffs] throttling...
Is there a way to throttle the firing of updater requests easily with
Prototype?
Thanks,
mark
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs