As controls are added to the page, they register and un-register their requirements with this manager. Then at render time the manager only renders
<link> tags for the required resources.
A basic implementation would be to have a dictionary with the resource URL as the key and a list of dependent controls as the value. Then at render time, if the list is empty, don't render the resource.
I'm wondering if there is an established pattern for this?
I'm using ASP.NET and C# if that bares any significance.
I was thinking about it and while the manager is controlling the dependencies of the controls of the page, the fact that they are dependencies is almost superfluous to my question.
I think what I'm looking for is something like the Observer Pattern but the observers don't require being notified, the manager simply needs to maintain a list of subscribers.