You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Really excited to find this library (h/t @knownasilya)
I'd love to use this in Denali, but I'd need one additional method on the container: a lookupAll(type) method. It would allow a consumer to lookup all the registrations for a given type. My suggestion would be to return an object keyed on the registrations' names or full specifiers, but an array would work just as well for me.
One potential sticking point would be for resolver-backed lookups, since the current approach is lazy (meaning that the container and resolver may not know the entire set of registrations available for a type when lookupAll is called). One potential solution would be to allow the resolver to supply an optional retrieveAll(type), and if the resolve doesn't define a retrieveAll (or perhaps it returns false), then the container would simply return whatever registrations it has (registry plus anything found from previous resolver lookups).
I'm also open to arguments that this is a bad idea - perhaps there's a better way to architect what I need (running initializer-style functions on everything of a certain eagerly loaded type).
Happy to PR my suggestion, but wanted to run it by you all first to get a 👍 / 👎
The text was updated successfully, but these errors were encountered:
Really excited to find this library (h/t @knownasilya)
I'd love to use this in Denali, but I'd need one additional method on the container: a
lookupAll(type)
method. It would allow a consumer to lookup all the registrations for a given type. My suggestion would be to return an object keyed on the registrations' names or full specifiers, but an array would work just as well for me.One potential sticking point would be for resolver-backed lookups, since the current approach is lazy (meaning that the container and resolver may not know the entire set of registrations available for a type when
lookupAll
is called). One potential solution would be to allow the resolver to supply an optionalretrieveAll(type)
, and if the resolve doesn't define a retrieveAll (or perhaps it returns false), then the container would simply return whatever registrations it has (registry plus anything found from previous resolver lookups).I'm also open to arguments that this is a bad idea - perhaps there's a better way to architect what I need (running initializer-style functions on everything of a certain eagerly loaded type).
Happy to PR my suggestion, but wanted to run it by you all first to get a 👍 / 👎
The text was updated successfully, but these errors were encountered: