Skip to content
This repository has been archived by the owner on Mar 20, 2021. It is now read-only.

Singletons should also be allowed to be instances #9

Open
bugs181 opened this issue Mar 12, 2019 · 1 comment
Open

Singletons should also be allowed to be instances #9

bugs181 opened this issue Mar 12, 2019 · 1 comment
Labels
enhancement New feature or request question Further information is requested

Comments

@bugs181
Copy link
Collaborator

bugs181 commented Mar 12, 2019

Singletons should also be allowed to be instances when it's fitting. Maybe perhaps determined by initializer. For example a Storage adapter may be a singleton for a specific connection/directory, but another singleton for a different directory. This essentially groups flows into singletons deterministically.

@bugs181 bugs181 added the enhancement New feature or request label Mar 12, 2019
@bugs181
Copy link
Collaborator Author

bugs181 commented Mar 12, 2019

I suppose we could leave these up to the blueprint implementations themselves. A top level singleton can choose to create a new instance of itself based on some factor.

Example implementation:

Blueprint = {
   instances: {},
   init: function(props, callback) {
       if (instances[props.path])
           return instances[props.path]

       // Set up a new instance to be shared here.
   }
}

@bugs181 bugs181 added the question Further information is requested label Mar 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant