Class YAHOO.ext.util.DelayedTask
| Package: | YAHOO.ext.util |
| Class: | DelayedTask |
| Extends: | Object |
| Defined In: | yutil.js |
Provides a convenient method of performing setTimeout where a new
timeout cancels the old timeout. An example would be performing validation on a keypress.
You can use this class to buffer
the keypress events for a certain number of milliseconds, and perform only if they stop
for that amount of time.
Public Properties
This class has no public properties.
Public Methods
| |
DelayedTask([Function fn], [Object scope], [Array args]) |
DelayedTask |
| The parameters to this constructor serve as defaults and are not required. |
| |
cancel() : void |
DelayedTask |
| Cancel the last queued timeout |
| |
delay(Number delay, [Function newFn], [Object newScope], [Array newArgs]) : void |
DelayedTask |
| Cancels any pending timeout and queues a new one |
Public Events
This class has no public events.
Constructor Details
DelayedTask
public function DelayedTask([Function fn], [Object scope], [Array args])
The parameters to this constructor serve as defaults and are not required.
Parameters:
fn : Function(optional) The default function to timeout
scope : Object(optional) The default scope of that timeout
args : Array(optional) The default Array of arguments
Method Details
cancel
public function cancel()
Cancel the last queued timeout
This method is defined by DelayedTask.
delay
public function delay(Number delay, [Function newFn], [Object newScope], [Array newArgs])
Cancels any pending timeout and queues a new one
Parameters:
delay : NumberThe milliseconds to delay
newFn : Function(optional) Overrides function passed to constructor
newScope : Object(optional) Overrides scope passed to constructor
newArgs : Array(optional) Overrides args passed to constructor
Returns:
This method is defined by DelayedTask.