Message from JavaScript discussions

June 2017

— SendFriends would be an emitter-type pattern?


Yes. In my real use case it is attaching objects in a component pattern in such a way that the attachee can access members you would not want to expose

— I see

— So


— You could do that with weakmaps too, heh

— Friends.set(thing, private)

— Yeah

— And a friend has access to the friends weakmap

— The basic concept is that revealing module pattern though, and using scope to more easily decide what to give back to the user

Message permanent page

— Yeah, it's pretty great

— It has a lot of room for framework-itis, if things don't go smoothly... Only a good idea when you have a really good reason to hide those members

Message permanent page

— The complexity you introduce by using it is a bit cumbersome, haha