Changes between Version 2 and Version 3 of Ticket #17249, comment 4


Ignore:
Timestamp:
Jun 12, 2013, 10:01:41 PM (7 years ago)
Author:
bill
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #17249, comment 4

    v2 v3  
    77Animation._stopTimer() doesn't cancel the timer because it thinks that other animations are running.  However, it does call this._timer.remove(), which should cancel the  aspect.after(runner, "run", ...).   But that remove() call isn't working correctly because the next time that runner.run() executes, there's an exception.
    88
    9 Maybe it's an issue with canceling some advice while in the handler for that advice, i.e. this pattern:
     9Maybe it's an issue with canceling some advice while in the handler for that advice,
    1010
    1111{{{
    12 // setup a few listeners
    13 aspect.after(foo, "bar", function(){  });
    1412var handle = aspect.after(foo, "bar", function(){ handle.remove(); });
    15 aspect.after(foo, "bar", function(){  });
    16 
    17 foo.bar();   --> this will remove the second listener
    18 foo.bar();   --> should work, only calling the first and third listener
    1913}}}
    2014
     15Except, I tried a standalone test for that, and it worked:
     16
     17{{{
     18var foo = { bar: function(){ console.log("bar"); } };
     19var aspect = require("dojo/aspect");
     20aspect.after(foo, "bar", function(){ console.log("first listener"); });
     21var handle = aspect.after(foo, "bar", function(){ console.log("second listener"); handle.remove(); });
     22aspect.after(foo, "bar", function(){ console.log("third listener"); });
     23
     24// fire three listeners, remove the second listener
     25foo.bar();
     26
     27// should work, only calling the first and third listener
     28foo.bar();
     29}}}
    2130
    2231PS: A similar problem was fixed for dijit/Dialog in #12436, but perhaps that's a red herring.