Upgrade to ExtJS 4.0.2 - Released 06/09/2011
[extjs.git] / docs / output / Ext.util.DelayedTask.js
1 Ext.data.JsonP.Ext_util_DelayedTask({
2   "allMixins": [
3
4   ],
5   "deprecated": null,
6   "docauthor": null,
7   "members": {
8     "cfg": [
9
10     ],
11     "method": [
12       {
13         "deprecated": null,
14         "alias": null,
15         "href": "DelayedTask.html#Ext-util-DelayedTask-method-constructor",
16         "tagname": "method",
17         "protected": false,
18         "shortDoc": "The parameters to this constructor serve as defaults and are not required. ...",
19         "static": false,
20         "params": [
21           {
22             "type": "Function",
23             "optional": true,
24             "doc": "<p>(optional) The default function to call.</p>\n",
25             "name": "fn"
26           },
27           {
28             "type": "Object",
29             "optional": true,
30             "doc": "<p>(optional) 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",
31             "name": "scope"
32           },
33           {
34             "type": "Array",
35             "optional": true,
36             "doc": "<p>(optional) The default Array of arguments.</p>\n",
37             "name": "args"
38           }
39         ],
40         "private": false,
41         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/util/DelayedTask.js",
42         "doc": "<p>The parameters to this constructor serve as defaults and are not required.</p>\n",
43         "owner": "Ext.util.DelayedTask",
44         "name": "DelayedTask",
45         "html_filename": "DelayedTask.html",
46         "return": {
47           "type": "Object",
48           "doc": "\n"
49         },
50         "linenr": 1
51       },
52       {
53         "deprecated": null,
54         "alias": null,
55         "protected": false,
56         "tagname": "method",
57         "href": "DelayedTask.html#Ext-util-DelayedTask-method-cancel",
58         "shortDoc": "Cancel the last queued timeout ...",
59         "static": false,
60         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/util/DelayedTask.js",
61         "private": false,
62         "params": [
63
64         ],
65         "name": "cancel",
66         "owner": "Ext.util.DelayedTask",
67         "doc": "<p>Cancel the last queued timeout</p>\n",
68         "linenr": 62,
69         "return": {
70           "type": "void",
71           "doc": "\n"
72         },
73         "html_filename": "DelayedTask.html"
74       },
75       {
76         "deprecated": null,
77         "alias": null,
78         "protected": false,
79         "tagname": "method",
80         "href": "DelayedTask.html#Ext-util-DelayedTask-method-delay",
81         "shortDoc": "Cancels any pending timeout and queues a new one ...",
82         "static": false,
83         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/util/DelayedTask.js",
84         "private": false,
85         "params": [
86           {
87             "type": "Number",
88             "optional": false,
89             "doc": "<p>The milliseconds to delay</p>\n",
90             "name": "delay"
91           },
92           {
93             "type": "Function",
94             "optional": true,
95             "doc": "<p>(optional) Overrides function passed to constructor</p>\n",
96             "name": "newFn"
97           },
98           {
99             "type": "Object",
100             "optional": true,
101             "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",
102             "name": "newScope"
103           },
104           {
105             "type": "Array",
106             "optional": true,
107             "doc": "<p>(optional) Overrides args passed to constructor</p>\n",
108             "name": "newArgs"
109           }
110         ],
111         "name": "delay",
112         "owner": "Ext.util.DelayedTask",
113         "doc": "<p>Cancels any pending timeout and queues a new one</p>\n",
114         "linenr": 46,
115         "return": {
116           "type": "void",
117           "doc": "\n"
118         },
119         "html_filename": "DelayedTask.html"
120       }
121     ],
122     "property": [
123
124     ],
125     "cssVar": [
126
127     ],
128     "cssMixin": [
129
130     ],
131     "event": [
132
133     ]
134   },
135   "singleton": false,
136   "alias": null,
137   "superclasses": [
138
139   ],
140   "protected": false,
141   "tagname": "class",
142   "mixins": [
143
144   ],
145   "href": "DelayedTask.html#Ext-util-DelayedTask",
146   "subclasses": [
147
148   ],
149   "static": false,
150   "author": null,
151   "component": false,
152   "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/util/DelayedTask.js",
153   "private": false,
154   "alternateClassNames": [
155
156   ],
157   "name": "Ext.util.DelayedTask",
158   "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",
159   "mixedInto": [
160
161   ],
162   "linenr": 1,
163   "xtypes": [
164
165   ],
166   "html_filename": "DelayedTask.html",
167   "extends": null
168 });