Properties Methods Events Direct Link

    TaskRunner
      TaskMgr

# Class Ext.TaskMgr

Package: | Ext
Defined In: | TaskMgr.js
Class: | TaskMgr
Extends: | TaskRunner

A static Ext.util.TaskRunner instance that can be used to start and stop arbitrary tasks. See Ext.util.TaskRunner for supported methods and task config properties.

    // Start a simple clock task that updates a div once per second
    var task = {
        run: function(){
            Ext.fly('clock').update(new Date().format('g:i:s A'));
        },
        interval: 1000 //1 second
    }
    Ext.TaskMgr.start(task);

This class is a singleton and cannot be created directly.

## Public Properties

This class has no public properties.

## Public Methods

Method | Defined By
--- | ---
| start( `Object task` ) : Object Starts a new task. Starts a new task. Parameters: `task` : Object A config object that supports the following properties: `run` : Function The function to execute each time the task is run. The function will be called at each interval and passed the `args` argument if specified. If a particular scope is required, be sure to specify it using the `scope` argument. `interval` : Number The frequency in milliseconds with which the task should be executed. `args` : Array (optional) An array of arguments to be passed to the function specified by `run`. `scope` : Object (optional) The scope (`this` reference) in which to execute the `run` function. Defaults to the task config object. `duration` : Number (optional) The length of time in milliseconds to execute the task before stopping automatically (defaults to indefinite). `repeat` : Number (optional) The number of times to execute the task before stopping automatically (defaults to indefinite). Returns: `Object` The task | TaskRunner
| stop( `Object task` ) : Object Stops an existing running task. Stops an existing running task. Parameters: `task` : Object The task to stop Returns: `Object` The task | TaskRunner
| stopAll() : void Stops all tasks that are currently running. Stops all tasks that are currently running. Parameters: None. Returns: void | TaskRunner

## Public Events

This class has no public events.