jaredhanson / electrolyte

Elegant dependency injection for Node.js.
MIT License
564 stars 59 forks source link

add singleton as source helper #72

Open piercus opened 6 years ago

piercus commented 6 years ago

Hello,

Following remarks in https://github.com/jaredhanson/electrolyte/issues/35, https://github.com/jaredhanson/electrolyte/pull/27 and https://github.com/jaredhanson/electrolyte/issues/35 i was not finding a good way to inject singletons manually.

I'd like to have this design

IoC.use(IoC.singleton('settings', {foo : 'bar'}));

Hope it will help someone

coveralls commented 6 years ago

Coverage Status

Coverage decreased (-1.6%) to 91.93% when pulling 799b0617244db4df78678362d641f4fce78570d1 on piercus:sources-singleton into d6af75b444e8c46bd62c2eb2b708b73af3145e62 on jaredhanson:master.