- Replaced color picker form control with a more robust version.
This commit is contained in:
parent
6fe068e42d
commit
6e0470771e
1193 changed files with 342 additions and 223 deletions
55
www/extras/extjs/docs/output/DelayedTask.jss.html
vendored
Normal file
55
www/extras/extjs/docs/output/DelayedTask.jss.html
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<html><head><title>DelayedTask.js</title><link rel="stylesheet" type="text/css" href="../resources/style.css" media="screen"/></head><body><h1>DelayedTask.js</h1><pre class="highlighted"><code><i>/**
|
||||
* @class Ext.util.DelayedTask
|
||||
* Provides a convenient method of performing setTimeout where a <b>new</b>
|
||||
* timeout cancels the old timeout. An example would be performing validation on a keypress.
|
||||
* You can use <b>this</b> class to buffer
|
||||
* the keypress events <b>for</b> a certain number of milliseconds, and perform only <b>if</b> they stop
|
||||
* <b>for</b> that amount of time.
|
||||
* @constructor The parameters to <b>this</b> constructor serve as defaults and are not required.
|
||||
* @param {Function} fn (optional) The <b>default</b> function to timeout
|
||||
* @param {Object} scope (optional) The <b>default</b> scope of that timeout
|
||||
* @param {Array} args (optional) The <b>default</b> Array of arguments
|
||||
*/</i>
|
||||
Ext.util.DelayedTask = <b>function</b>(fn, scope, args){
|
||||
<b>var</b> id = null, d, t;
|
||||
|
||||
<b>var</b> call = <b>function</b>(){
|
||||
<b>var</b> now = <b>new</b> Date().getTime();
|
||||
<b>if</b>(now - t >= d){
|
||||
clearInterval(id);
|
||||
id = null;
|
||||
fn.apply(scope, args || []);
|
||||
}
|
||||
};
|
||||
<i>/**
|
||||
* Cancels any pending timeout and queues a <b>new</b> one
|
||||
* @param {Number} delay The milliseconds to delay
|
||||
* @param {Function} newFn (optional) Overrides <b>function</b> passed to constructor
|
||||
* @param {Object} newScope (optional) Overrides scope passed to constructor
|
||||
* @param {Array} newArgs (optional) Overrides args passed to constructor
|
||||
*/</i>
|
||||
<b>this</b>.delay = <b>function</b>(delay, newFn, newScope, newArgs){
|
||||
<b>if</b>(id && delay != d){
|
||||
<b>this</b>.cancel();
|
||||
}
|
||||
d = delay;
|
||||
t = <b>new</b> Date().getTime();
|
||||
fn = newFn || fn;
|
||||
scope = newScope || scope;
|
||||
args = newArgs || args;
|
||||
<b>if</b>(!id){
|
||||
id = setInterval(call, d);
|
||||
}
|
||||
};
|
||||
|
||||
<i>/**
|
||||
* Cancel the last queued timeout
|
||||
*/</i>
|
||||
<b>this</b>.cancel = <b>function</b>(){
|
||||
<b>if</b>(id){
|
||||
clearInterval(id);
|
||||
id = null;
|
||||
}
|
||||
};
|
||||
};</code></pre><hr><div style="font-size:10px;text-align:center;color:gray;">Ext - Copyright © 2006-2007 Ext JS, LLC<br />All rights reserved.</div>
|
||||
</body></html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue