Print Friendly

# Class Ext.util.DelayedTask

Package: | Ext.util
Class: | DelayedTask
Extends: | Object
Defined In: | DelayedTask.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.
Properties - Methods - Events

## Public Properties

This class has no public properties.

## Public Methods

Method | Defined By
--- | ---
| 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
Parameters:

- None.

Returns:

- `void`

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` : 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`

This method is defined by DelayedTask.

Ext - Copyright © 2006-2007 Ext JS, LLC
All rights reserved.