Upgrade to ExtJS 4.0.1 - Released 05/18/2011
[extjs.git] / docs / output / Ext.util.DelayedTask.js
1 Ext.data.JsonP.Ext_util_DelayedTask({
2   "tagname": "class",
3   "name": "Ext.util.DelayedTask",
4   "doc": "<p>The DelayedTask class provides a convenient way to \"buffer\" the execution of a method,\nperforming setTimeout where a new timeout cancels the old timeout. When called, the\ntask will wait the specified time period before executing. If durng that time period,\nthe task is called again, the original call will be cancelled. This continues so that\nthe function is only called a single time for each iteration.</p>\n\n<p>This method is especially useful for things like detecting whether a user has finished\ntyping in a text field. An example would be performing validation on a keypress. You can\nuse this class to buffer the keypress events for a certain number of milliseconds, and\nperform only if they stop for that amount of time.</p>\n\n<h2>Usage</h2>\n\n<pre><code>var task = new Ext.util.DelayedTask(function(){\n    alert(Ext.getDom('myInputField').value.length);\n});\n\n// Wait 500ms before calling our function. If the user presses another key\n// during that 500ms, it will be cancelled and we'll wait another 500ms.\nExt.get('myInputField').on('keypress', function(){\n    task.<a href=\"#/api/Ext.util.DelayedTask-method-delay\" rel=\"Ext.util.DelayedTask-method-delay\" class=\"docClass\">delay</a>(500);\n});\n</code></pre>\n\n<p>Note that we are using a DelayedTask here to illustrate a point. The configuration\noption <code>buffer</code> for <a href=\"#/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">addListener/on</a> will\nalso setup a delayed task for you to buffer events.</p>\n",
5   "extends": null,
6   "mixins": [
7
8   ],
9   "alternateClassNames": [
10
11   ],
12   "xtype": null,
13   "author": null,
14   "docauthor": null,
15   "singleton": false,
16   "private": false,
17   "cfg": [
18
19   ],
20   "method": [
21     {
22       "tagname": "method",
23       "name": "DelayedTask",
24       "member": "Ext.util.DelayedTask",
25       "doc": "<p>The parameters to this constructor serve as defaults and are not required.</p>\n",
26       "params": [
27         {
28           "type": "Function",
29           "name": "fn",
30           "doc": "<p>(optional) The default function to call.</p>\n",
31           "optional": true
32         },
33         {
34           "type": "Object",
35           "name": "scope",
36           "doc": "<p>The default scope (The <code><b>this</b></code> reference) in which the\nfunction is called. If not specified, <code>this</code> will refer to the browser window.</p>\n",
37           "optional": false
38         },
39         {
40           "type": "Array",
41           "name": "args",
42           "doc": "<p>(optional) The default Array of arguments.</p>\n",
43           "optional": true
44         }
45       ],
46       "return": {
47         "type": "void",
48         "doc": "\n"
49       },
50       "private": false,
51       "static": false,
52       "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/util/DelayedTask.js",
53       "linenr": 1,
54       "html_filename": "DelayedTask.html",
55       "href": "DelayedTask.html#Ext-util-DelayedTask-method-constructor",
56       "shortDoc": "<p>The parameters to this constructor serve as defaults and are not required.</p>\n"
57     },
58     {
59       "tagname": "method",
60       "name": "cancel",
61       "member": "Ext.util.DelayedTask",
62       "doc": "<p>Cancel the last queued timeout</p>\n",
63       "params": [
64
65       ],
66       "return": {
67         "type": "void",
68         "doc": "\n"
69       },
70       "private": false,
71       "static": false,
72       "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/util/DelayedTask.js",
73       "linenr": 62,
74       "html_filename": "DelayedTask.html",
75       "href": "DelayedTask.html#Ext-util-DelayedTask-method-cancel",
76       "shortDoc": "<p>Cancel the last queued timeout</p>\n"
77     },
78     {
79       "tagname": "method",
80       "name": "delay",
81       "member": "Ext.util.DelayedTask",
82       "doc": "<p>Cancels any pending timeout and queues a new one</p>\n",
83       "params": [
84         {
85           "type": "Number",
86           "name": "delay",
87           "doc": "<p>The milliseconds to delay</p>\n",
88           "optional": false
89         },
90         {
91           "type": "Function",
92           "name": "newFn",
93           "doc": "<p>(optional) Overrides function passed to constructor</p>\n",
94           "optional": true
95         },
96         {
97           "type": "Object",
98           "name": "newScope",
99           "doc": "<p>(optional) Overrides scope passed to constructor. Remember that if no scope\nis specified, <code>this</code> will refer to the browser window.</p>\n",
100           "optional": true
101         },
102         {
103           "type": "Array",
104           "name": "newArgs",
105           "doc": "<p>(optional) Overrides args passed to constructor</p>\n",
106           "optional": true
107         }
108       ],
109       "return": {
110         "type": "void",
111         "doc": "\n"
112       },
113       "private": false,
114       "static": false,
115       "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/util/DelayedTask.js",
116       "linenr": 46,
117       "html_filename": "DelayedTask.html",
118       "href": "DelayedTask.html#Ext-util-DelayedTask-method-delay",
119       "shortDoc": "<p>Cancels any pending timeout and queues a new one</p>\n"
120     }
121   ],
122   "property": [
123
124   ],
125   "event": [
126
127   ],
128   "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/util/DelayedTask.js",
129   "linenr": 1,
130   "html_filename": "DelayedTask.html",
131   "href": "DelayedTask.html#Ext-util-DelayedTask",
132   "cssVar": [
133
134   ],
135   "cssMixin": [
136
137   ],
138   "component": false,
139   "superclasses": [
140
141   ],
142   "subclasses": [
143
144   ],
145   "mixedInto": [
146
147   ],
148   "allMixins": [
149
150   ]
151 });