incubator-flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Heidegger ...@leichtgewicht.at>
Subject Re: JavaScript VS. Weak references
Date Tue, 07 Feb 2012 20:44:30 GMT
On 08/02/2012 05:36, Maciek Sakrejda wrote:
> How so?...
My very tired brain pictures a implementation like:

class EventDispatcher {
   private var _listeners: Object = {};

   public function addEventListener(event: String, listener: Function) {
      if((_listeners[event] ||= []).indexOf(listener) == -1) {
          _listeners[event].push(listener);
      }
   }
}

Then we have the instance referencing to a object referencing to a array 
referencing to the original instance creating a big cyclic reference. I 
am pretty sure that this should resolve itself once there is no 
reference anymore to that instance but somewhere in my mind I had a 
thought why this would be a problem.

Ah, I guess I should go to bed, gn8

Martin.



Mime
View raw message