今天用到EXT的定时调用。
EXT的定时调用类Ext.util.TaskRunner,还有一个继承了该类的定时调用类为:Ext.util.TaskManager
例:var runner = new Ext.util.TaskRunner();
var task = runner.start(
{
run: function(){
//这里简单的输出 也可以有复杂处理,例如:定时从后台取值,在前台刷新数据
console.log(new Date());
},
interval: 1000 //The timer resolution.
repeat:3 //The number of times to invoke the task before stopping automatically (defaults to definite).
});
停止一个任务:
runner.stop(task); //Stops an existing running task.
runner.stopAll(); //Stops all tasks that are currently running.
runner.destroy(); //Destroys this instance, stopping all tasks that are currently running.