Weak event listener

David Bruant bruant.d at gmail.com
Tue Mar 26 14:47:27 PDT 2013

Le 26/03/2013 21:26, Brandon Benvie a écrit :
> On 3/26/2013 1:03 PM, David Bruant wrote:
>> I'm starting to wonder whether bringing weakrefs is equivalent to 
>> having iterable WeakMaps... And if so, why not make WeakMaps iterable?
> This is a question I had as well. An iterable WeakMap is nearly the 
> same as a Map full of WeakRefs, is it not? Just a different API that 
> is less usable for single references and more usable for collections.
Interestingly, publish-subscribe would probably make a better use of an 
iterable weakset (set of observers) I think:
When a publication happens, what needs to be done is tell all the 
(remaning) subscribers. I don't think anyone really needs the weakrefs 
themselves. Iterating over remaining observers seems to be enough.


More information about the es-discuss mailing list