Message from JavaScript discussions

June 2017

— I don't think I've ever had the need to share privates with 'friends' that can't just be public


And the function definition for the thunk must be scope restricted so that it may see the event bus or friend classes, while the user cannot

— Heh, in a large framework or library it can get a little crazy

— 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

Message permanent page

— 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