commit extjs-2.2.1
[extjs.git] / docs / output / Ext.util.TaskRunner.html
1         <div class="body-wrap">
2         <div class="top-tools">
3             <a class="inner-link" href="#Ext.util.TaskRunner-props"><img src="../resources/images/default/s.gif" class="item-icon icon-prop">Properties</a>
4             <a class="inner-link" href="#Ext.util.TaskRunner-methods"><img src="../resources/images/default/s.gif" class="item-icon icon-method">Methods</a>
5             <a class="inner-link" href="#Ext.util.TaskRunner-events"><img src="../resources/images/default/s.gif" class="item-icon icon-event">Events</a>
6                         <a class="bookmark" href="../docs/?class=Ext.util.TaskRunner"><img src="../resources/images/default/s.gif" class="item-icon icon-fav">Direct Link</a>
7         </div>
8                 <h1>Class Ext.util.TaskRunner</h1>
9         <table cellspacing="0">
10             <tr><td class="label">Package:</td><td class="hd-info">Ext.util</td></tr>
11             <tr><td class="label">Defined In:</td><td class="hd-info"><a href="../src/TaskMgr.js" target="_blank">TaskMgr.js</a></td></tr>
12             <tr><td class="label">Class:</td><td class="hd-info">TaskRunner</td></tr>
13                                     <tr><td class="label">Extends:</td><td class="hd-info">Object</td></tr>
14                     </table>
15         <div class="description">
16             *
17 Provides the ability to execute one or more arbitrary tasks in a multithreaded manner.  Generally, you can use
18 the singleton <a ext:cls="Ext.TaskMgr" href="output/Ext.TaskMgr.html">Ext.TaskMgr</a> instead, but if needed, you can create separate instances of TaskRunner.  Any
19 number of separate tasks can be started at any time and will run independently of each other.  Example usage:
20 <pre><code><i>// Start a simple clock task that updates a div once per second</i>
21 <b>var</b> task = {
22     run: <b>function</b>(){
23         Ext.fly(<em>'clock'</em>).update(<b>new</b> Date().format(<em>'g:i:s A'</em>));
24     },
25     interval: 1000 <i>//1 second</i>
26 }
27 <b>var</b> runner = <b>new</b> Ext.util.TaskRunner();
28 runner.start(task);</code></pre>        </div>
29         
30         <div class="hr"></div>
31                 <a id="Ext.util.TaskRunner-props"></a>
32         <h2>Public Properties</h2>
33         <div class="no-members">This class has no public properties.</div>        <a id="Ext.util.TaskRunner-methods"></a>
34         <h2>Public Methods</h2>
35                 <table cellspacing="0" class="member-table">
36             <tr>
37                 <th class="sig-header" colspan="2">Method</th>
38                 <th class="msource-header">Defined By</th>
39             </tr>
40                 <tr class="method-row expandable">\r
41         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
42         <td class="sig">\r
43         <a id="Ext.util.TaskRunner-TaskRunner"></a>\r
44             <b>TaskRunner</b>(&nbsp;<span class="optional" title="Optional">[<code>Number interval</code>]</span>&nbsp;)            <div class="mdesc">\r
45                         <div class="short"></div>\r
46             <div class="long">\r
47                     <div class="mdetail-params">\r
48         <strong>Parameters:</strong>\r
49         <ul><li><code>interval</code> : Number<div class="sub-desc">(optional) The minimum precision in milliseconds supported by this TaskRunner instance
50 (defaults to 10)</div></li>        </ul>\r
51         <strong>Returns:</strong>\r
52         <ul>\r
53             <li><code></code></li>\r
54         </ul>\r
55     </div>\r
56                 </div>\r
57                         </div>\r
58         </td>\r
59         <td class="msource">TaskRunner</td>\r
60     </tr>\r
61         <tr class="method-row alt expandable">\r
62         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
63         <td class="sig">\r
64         <a id="Ext.util.TaskRunner-start"></a>\r
65             <b>start</b>(&nbsp;<span class="optional" title="Optional">[<code>Object task</code>]</span>&nbsp;) : Object            <div class="mdesc">\r
66                         <div class="short">Starts a new task.</div>\r
67             <div class="long">\r
68                 Starts a new task.    <div class="mdetail-params">\r
69         <strong>Parameters:</strong>\r
70         <ul><li><code>task</code> : Object<div class="sub-desc">A config object that supports the following properties:<ul>
71 <li><code>run</code> : Function<div class="sub-desc">The function to execute each time the task is run. The
72 function will be called at each interval and passed the <code>args</code> argument if specified. If a
73 particular scope is required, be sure to specify it using the <code>scope</scope> argument.</div></li>
74 <li><code>interval</code> : Number<div class="sub-desc">The frequency in milliseconds with which the task
75 should be executed.</div></li>
76 <li><code>args</code> : Array<div class="sub-desc">(optional) An array of arguments to be passed to the function
77 specified by <code>run</code>.</div></li>
78 <li><code>scope</code> : Object<div class="sub-desc">(optional) The scope in which to execute the
79 <code>run</code> function.</div></li>
80 <li><code>duration</code> : Number<div class="sub-desc">(optional) The length of time in milliseconds to execute
81 the task before stopping automatically (defaults to indefinite).</div></li>
82 <li><code>repeat</code> : Number<div class="sub-desc">(optional) The number of times to execute the task before
83 stopping automatically (defaults to indefinite).</div></li>
84 </ul></div></li>        </ul>\r
85         <strong>Returns:</strong>\r
86         <ul>\r
87             <li><code>Object</code><div class="sub-desc">The task</div></li>\r
88         </ul>\r
89     </div>\r
90                 </div>\r
91                         </div>\r
92         </td>\r
93         <td class="msource">TaskRunner</td>\r
94     </tr>\r
95         <tr class="method-row expandable">\r
96         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
97         <td class="sig">\r
98         <a id="Ext.util.TaskRunner-stop"></a>\r
99             <b>stop</b>(&nbsp;<code>Object task</code>&nbsp;) : Object            <div class="mdesc">\r
100                         <div class="short">Stops an existing running task.</div>\r
101             <div class="long">\r
102                 Stops an existing running task.    <div class="mdetail-params">\r
103         <strong>Parameters:</strong>\r
104         <ul><li><code>task</code> : Object<div class="sub-desc">The task to stop</div></li>        </ul>\r
105         <strong>Returns:</strong>\r
106         <ul>\r
107             <li><code>Object</code><div class="sub-desc">The task</div></li>\r
108         </ul>\r
109     </div>\r
110                 </div>\r
111                         </div>\r
112         </td>\r
113         <td class="msource">TaskRunner</td>\r
114     </tr>\r
115         <tr class="method-row alt expandable">\r
116         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
117         <td class="sig">\r
118         <a id="Ext.util.TaskRunner-stopAll"></a>\r
119             <b>stopAll</b>() : void            <div class="mdesc">\r
120                         <div class="short">Stops all tasks that are currently running.</div>\r
121             <div class="long">\r
122                 Stops all tasks that are currently running.    <div class="mdetail-params">\r
123         <strong>Parameters:</strong>\r
124         <ul><li>None.</li>        </ul>\r
125         <strong>Returns:</strong>\r
126         <ul>\r
127             <li><code>void</code></li>\r
128         </ul>\r
129     </div>\r
130                 </div>\r
131                         </div>\r
132         </td>\r
133         <td class="msource">TaskRunner</td>\r
134     </tr>\r
135             </table>
136                 <a id="Ext.util.TaskRunner-events"></a>
137         <h2>Public Events</h2>
138         <div class="no-members">This class has no public events.</div>
139         </div>