Properties Methods Events Direct Link

# Class Ext.util.DelayedTask

Package: | Ext.util
Defined In: | DelayedTask.js
Class: | DelayedTask
Extends: | Object

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

Method | Defined By
--- | ---

DelayedTask( [`Function fn`], [`Object scope`], [`Array args`] )
The parameters to this constructor serve as defaults and are not required.
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

Returns:

- ``

DelayedTask

cancel() : void
Cancel the last queued timeout
Cancel the last queued timeout
Parameters:

- None.

Returns:

- `void`

DelayedTask

delay( `Number delay`, [`Function newFn`], [`Object newScope`], [`Array newArgs`] ) : void
Cancels any pending timeout and queues a new one
Cancels any pending timeout and queues a new one
Parameters:

- `delay` : Number
  The 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:

- `void`

DelayedTask

## Public Events

This class has no public events.