1. #1
    Sencha User
    Join Date
    Jun 2009
    Posts
    352
    Vote Rating
    1
    parky128 is on a distinguished road

      0  

    Default Question about DelayedTask

    Question about DelayedTask


    Hi,

    I am trying to get a DelayedTask function to loop at a set interval using the following code:

    Code:
    this.delayedRefreshTaskInterval = 5000;
    
    this.delayedRefreshTask = new Ext.util.DelayedTask(function(){
        this.raiseEvent('checkforupdates');
        this.delayedRefreshTask.delay(this.delayedRefreshTaskInterval);
    }, this);
    I am defining the above code in my launch function of my application code, not sure this is the correct thing to do actually??

    I can kick this off elsewhere in some controller code by doing:

    Code:
    this.getApplication().delayedRefreshTask.delay(this.getApplication().delayedRefreshTaskInterval);
    The 'checkforupdates' call in the function does get fired after 5 seconds, but it doesn't continue to get fired every 5 seconds as I would expect.

    Where am I going wrong here please?

  2. #2
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    507
    Vote Rating
    18
    estesbubba will become famous soon enough estesbubba will become famous soon enough

      0  

    Default


    I think DelayedTask is a one and done. Try a task.delay() again once the timer pops.

  3. #3
    Sencha User
    Join Date
    Jun 2009
    Posts
    352
    Vote Rating
    1
    parky128 is on a distinguished road

      0  

    Default


    But I am calling delay within the function itself after I do what I need to do, so it then calls itself again after the set interval period elapses.

  4. #4
    Ext JS Premium Member
    Join Date
    Feb 2012
    Posts
    5
    Vote Rating
    0
    wenying.yang@hp.com is on a distinguished road

      0  

    Default


    hi, i meet the same issue when using delayedtask, the thing is if in debug mode, step into the delay method once, it scheduled correctly... any idea?