Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / docs / api / Ext.util.DelayedTask.html
diff --git a/docs/api/Ext.util.DelayedTask.html b/docs/api/Ext.util.DelayedTask.html
new file mode 100644 (file)
index 0000000..64e430b
--- /dev/null
@@ -0,0 +1,86 @@
+<!DOCTYPE html><html><head><title>Ext.util.DelayedTask | Ext JS 4.0 Documentation</title><script type="text/javascript" src="../ext-all.js"></script><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../scrollbars.css" type="text/css"><link rel="stylesheet" href="../docs.css" type="text/css"><link id="styleCss" rel="stylesheet" href="../style.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script><link rel="stylesheet" href="../prettify.css" type="text/css"><!-- link(rel: 'stylesheet', href: req.baseURL + '/css/ext4.css', type: 'text/css')--><link rel="shortcut icon" type="image/ico" href="../favicon.ico"><!--[if IE]>
+<style type="text/css">.head-band { display: none; }
+.header { border: 0; top: 0; left: 0px; background: url(../header.gif) repeat-x; }
+.doc-tab .members .member a.more { background-color: #efefef; }
+</style><link rel="stylesheet" href="/new/css/ie.css" type="text/css"><![endif]-->
+</head><body id="ext-body" class="iScroll"><div id="notice" class="notice">For up to date documentation and features, visit 
+<a href="http://docs.sencha.com/ext-js/4-0">http://docs.sencha.com/ext-js/4-0</a></div><div class="wrapper"><div class="head-band"></div><div class="header"><h2><a href="../index.html">Sencha Documentation</a></h2></div><div id="search"><form><input type="text" placeholder="Search" id="search-field" autocomplete="off" name="q"></form><div id="search-box"></div></div><div id="treePanel"></div><div id="container"><script type="text/javascript">
+
+    req = {
+        liveURL: '.',
+        standAloneMode: true,
+        origDocClass: 'Ext.util.DelayedTask',
+        docClass: 'Ext.util.DelayedTask',
+        docReq: 'Ext.util.DelayedTask',
+        version: '4.0',
+        baseURL: '.',
+        baseDocURL: '.',
+        baseProdURL: '.'
+    };
+
+    clsInfo = {};
+
+
+
+</script>
+
+<script type="text/javascript" src="../search.js"></script>
+<!--script type="text/javascript" src="/new/javascripts/app/examples.js"></script-->
+<script type="text/javascript" src="../class_tree.js"></script>
+<script type="text/javascript" src="../class_doc.js"></script>
+<script type="text/javascript">
+    req.source = 'DelayedTask.html#Ext-util.DelayedTask';
+    clsInfo = {"methods":["DelayedTask","cancel","delay"],"cfgs":[],"properties":[],"events":[],"subclasses":[]};
+    Ext.onReady(function() {
+        Ext.create('Docs.classPanel');
+    });
+</script><div id="top-block" class="top-block"><h1 id="clsTitle" class="cls"><a href="../source/DelayedTask.html#Ext-util.DelayedTask" target="_blank">Ext.util.DelayedTask</a></h1></div><div id="docContent"><div id="doc-overview-content"><div class="lft"><p>The DelayedTask class provides a convenient way to "buffer" the execution of a method,
+performing setTimeout where a new timeout cancels the old timeout. When called, the
+task will wait the specified time period before executing. If durng that time period,
+the task is called again, the original call will be cancelled. This continues so that
+the function is only called a single time for each iteration.</p>
+
+<p>This method is especially useful for things like detecting whether a user has finished
+typing in a text field. 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.</p>
+
+<h2>Usage</h2>
+
+<pre class="prettyprint"><code>var task = new Ext.util.DelayedTask(function(){
+    alert(Ext.getDom('myInputField').value.length);
+});
+
+// Wait 500ms before calling our function. If the user presses another key
+// during that 500ms, it will be cancelled and we'll wait another 500ms.
+Ext.get('myInputField').on('keypress', function(){
+    task.<a href="Ext.util.DelayedTask.html#delay" rel="Ext.util.DelayedTask#delay" class="docClass">delay</a>(500);
+});
+</code></pre>
+
+<p>Note that we are using a DelayedTask here to illustrate a point. The configuration
+option <code>buffer</code> for <a href="Ext.util.Observable.html#addListener" rel="Ext.util.Observable#addListener" class="docClass">addListener/on</a> will
+also setup a delayed task for you to buffer events.</p>
+<div class="members"><div class="m-methods"><a name="methods"></a><div class="definedBy">Defined By</div><h3 class="mth p">Methods</h3><div id="method-DelayedTask" class="member f ni"><a href="Ext.util.DelayedTask.html#method-DelayedTask" rel="method-DelayedTask" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.DelayedTask.html" class="definedIn docClass">Ext.util.DelayedTask</a><br/><a href="../source/DelayedTask.html#Ext-util.DelayedTask-method-constructor" class="viewSource">view source</a></div><a name="DelayedTask"></a><a name="method-DelayedTask"></a><a href="Ext.util.DelayedTask.html#" rel="method-DelayedTask" class="cls expand">DelayedTask</a>(
+<span class="pre">[Function fn], Object scope, [Array args]</span>)
+ : void</div><div class="description"><div class="short"><p>The parameters to this constructor serve as defaults and are not required.</p>
+</div><div class="long"><p>The parameters to this constructor serve as defaults and are not required.</p>
+<h3 class="pa">Parameters</h3><ul><li><span class="pre">fn</span> : Function<div class="sub-desc"><p>(optional) The default function to call.</p>
+</div></li><li><span class="pre">scope</span> : Object<div class="sub-desc"><p>The default scope (The <code><b>this</b></code> reference) in which the
+function is called. If not specified, <code>this</code> will refer to the browser window.</p>
+</div></li><li><span class="pre">args</span> : Array<div class="sub-desc"><p>(optional) The default Array of arguments.</p>
+</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
+</li></ul></div></div></div><div id="method-cancel" class="member ni"><a href="Ext.util.DelayedTask.html#method-cancel" rel="method-cancel" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.DelayedTask.html" class="definedIn docClass">Ext.util.DelayedTask</a><br/><a href="../source/DelayedTask.html#Ext-util.DelayedTask-method-cancel" class="viewSource">view source</a></div><a name="cancel"></a><a name="method-cancel"></a><a href="Ext.util.DelayedTask.html#" rel="method-cancel" class="cls expand">cancel</a> : void</div><div class="description"><div class="short"><p>Cancel the last queued timeout</p>
+</div><div class="long"><p>Cancel the last queued timeout</p>
+<h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
+</li></ul></div></div></div><div id="method-delay" class="member ni"><a href="Ext.util.DelayedTask.html#method-delay" rel="method-delay" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.DelayedTask.html" class="definedIn docClass">Ext.util.DelayedTask</a><br/><a href="../source/DelayedTask.html#Ext-util.DelayedTask-method-delay" class="viewSource">view source</a></div><a name="delay"></a><a name="method-delay"></a><a href="Ext.util.DelayedTask.html#" rel="method-delay" class="cls expand">delay</a>(
+<span class="pre">Number delay, [Function newFn], [Object newScope], [Array newArgs]</span>)
+ : void</div><div class="description"><div class="short"><p>Cancels any pending timeout and queues a new one</p>
+</div><div class="long"><p>Cancels any pending timeout and queues a new one</p>
+<h3 class="pa">Parameters</h3><ul><li><span class="pre">delay</span> : Number<div class="sub-desc"><p>The milliseconds to delay</p>
+</div></li><li><span class="pre">newFn</span> : Function<div class="sub-desc"><p>(optional) Overrides function passed to constructor</p>
+</div></li><li><span class="pre">newScope</span> : Object<div class="sub-desc"><p>(optional) Overrides scope passed to constructor. Remember that if no scope
+is specified, <code>this</code> will refer to the browser window.</p>
+</div></li><li><span class="pre">newArgs</span> : Array<div class="sub-desc"><p>(optional) Overrides args passed to constructor</p>
+</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
+</li></ul></div></div></div></div></div></div></div><div id="pageContent"></div></div></div></div></body></html>
\ No newline at end of file