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