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