var UtilityClass =function() ...{ return...{ myOtherTask: function(val) ...{ console.log('running in a different class: '+ val) } }; }; var TaskMgrTest =function() ...{ return...{ init: function() ...{ var util =new UtilityClass(); /**//* run this.myTask every 5000ms in the scope of this */ Ext.TaskMgr.start(...{run: this.myTask, interval: 5000, scope: this}); /**//* run util.myOtherTask every 500ms for 5000ms in the scope of util */ /**//* override the default argument by a passed in array */ Ext.TaskMgr.start(...{run: util.myOtherTask, interval: 500, scope: util, args: ['overriden value'], duration: 5000}); /**//* run this.theLastOne every 1000ms 10x in the scope of this */ /**//* defer (delay) the scheduling of the task for 4000ms */ Ext.TaskMgr.start.defer(4000, this, [...{run: this.theLastOne, interval: 1000, repeat: 10, scope: this}]); }, myTask: function() ...{ console.log('hola '+new Date().getTime()); }, /**//* by default we are passed an argument of numTimesRun */ /**//* which keeps track of how many times this task has run */ theLastOne: function(numTimesRun) ...{ console.log('only run '+ numTimesRun +'/10'); } }; }(); Ext.EventManager.onDocumentReady(TaskMgrTest.init, TaskMgrTest);