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"> |
---|
41 | <td class="micon"><a class="exi" href="#expand"> </a></td> |
---|
42 | <td class="sig"> |
---|
43 | <a id="Ext.util.TaskRunner-TaskRunner"></a> |
---|
44 | <b>TaskRunner</b>( <span class="optional" title="Optional">[<code>Number interval</code>]</span> ) <div class="mdesc"> |
---|
45 | <div class="short"></div> |
---|
46 | <div class="long"> |
---|
47 | <div class="mdetail-params"> |
---|
48 | <strong>Parameters:</strong> |
---|
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> |
---|
51 | <strong>Returns:</strong> |
---|
52 | <ul> |
---|
53 | <li><code></code></li> |
---|
54 | </ul> |
---|
55 | </div> |
---|
56 | </div> |
---|
57 | </div> |
---|
58 | </td> |
---|
59 | <td class="msource">TaskRunner</td> |
---|
60 | </tr> |
---|
61 | <tr class="method-row alt expandable"> |
---|
62 | <td class="micon"><a class="exi" href="#expand"> </a></td> |
---|
63 | <td class="sig"> |
---|
64 | <a id="Ext.util.TaskRunner-start"></a> |
---|
65 | <b>start</b>( <span class="optional" title="Optional">[<code>Object task</code>]</span> ) : Object <div class="mdesc"> |
---|
66 | <div class="short">Starts a new task.</div> |
---|
67 | <div class="long"> |
---|
68 | Starts a new task. <div class="mdetail-params"> |
---|
69 | <strong>Parameters:</strong> |
---|
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> |
---|
85 | <strong>Returns:</strong> |
---|
86 | <ul> |
---|
87 | <li><code>Object</code><div class="sub-desc">The task</div></li> |
---|
88 | </ul> |
---|
89 | </div> |
---|
90 | </div> |
---|
91 | </div> |
---|
92 | </td> |
---|
93 | <td class="msource">TaskRunner</td> |
---|
94 | </tr> |
---|
95 | <tr class="method-row expandable"> |
---|
96 | <td class="micon"><a class="exi" href="#expand"> </a></td> |
---|
97 | <td class="sig"> |
---|
98 | <a id="Ext.util.TaskRunner-stop"></a> |
---|
99 | <b>stop</b>( <code>Object task</code> ) : Object <div class="mdesc"> |
---|
100 | <div class="short">Stops an existing running task.</div> |
---|
101 | <div class="long"> |
---|
102 | Stops an existing running task. <div class="mdetail-params"> |
---|
103 | <strong>Parameters:</strong> |
---|
104 | <ul><li><code>task</code> : Object<div class="sub-desc">The task to stop</div></li> </ul> |
---|
105 | <strong>Returns:</strong> |
---|
106 | <ul> |
---|
107 | <li><code>Object</code><div class="sub-desc">The task</div></li> |
---|
108 | </ul> |
---|
109 | </div> |
---|
110 | </div> |
---|
111 | </div> |
---|
112 | </td> |
---|
113 | <td class="msource">TaskRunner</td> |
---|
114 | </tr> |
---|
115 | <tr class="method-row alt expandable"> |
---|
116 | <td class="micon"><a class="exi" href="#expand"> </a></td> |
---|
117 | <td class="sig"> |
---|
118 | <a id="Ext.util.TaskRunner-stopAll"></a> |
---|
119 | <b>stopAll</b>() : void <div class="mdesc"> |
---|
120 | <div class="short">Stops all tasks that are currently running.</div> |
---|
121 | <div class="long"> |
---|
122 | Stops all tasks that are currently running. <div class="mdetail-params"> |
---|
123 | <strong>Parameters:</strong> |
---|
124 | <ul><li>None.</li> </ul> |
---|
125 | <strong>Returns:</strong> |
---|
126 | <ul> |
---|
127 | <li><code>void</code></li> |
---|
128 | </ul> |
---|
129 | </div> |
---|
130 | </div> |
---|
131 | </div> |
---|
132 | </td> |
---|
133 | <td class="msource">TaskRunner</td> |
---|
134 | </tr> |
---|
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> |
---|