/**
* @class Ext.util.TaskRunner
* Provides the ability to execute one or more arbitrary tasks in a multithreaded
* manner. Generally, you can use the singleton {@link Ext.TaskMgr} 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:
*
// Start a simple clock task that updates a div once per second
var updateClock = function(){
Ext.fly('clock').update(new Date().format('g:i:s A'));
}
var task = {
run: updateClock,
interval: 1000 //1 second
}
var runner = new Ext.util.TaskRunner();
runner.start(task);
// equivalent using TaskMgr
Ext.TaskMgr.start({
run: updateClock,
interval: 1000
});
Ext.TaskMgr.start
最新推荐文章于 2017-11-14 17:23:00 发布
本文介绍了一个名为TaskRunner的实用工具,它允许开发者在多线程环境中执行一个或多个独立的任务。通过简单的示例展示了如何使用TaskRunner或TaskMgr启动周期性任务,例如每秒更新时钟显示。
4812

被折叠的 条评论
为什么被折叠?



