I thought about this the other day and it seems to me, if you were to use
something like AMD (require.js), your container would be a simple
configuration. This line is basically asking a container to provide a data
provider with an id.
define(['dataProvider'], function(provider) {
});
Switching out providers is fairly easy as your container would define a
mock provider in testing and the real one in live mode. This isn't exactly
the heavy DI that's common in C#/Java. I've learned to accept simplicity is
a good thing.
On Friday, July 27, 2012 7:45:48 AM UTC-7, Eldar wrote:
>
> Do we need this in Node?
>
> My answer is yes we need some (simple) way to specify the app level
> dependencies at runtime. Here is my take on
> this<https://github.com/eldargab/node-runtime>.
> Please checkout and let me know how do you feel about.
>
> But the idea is very simple:
>
> // inside any index.jsvar R = require('runtime').patchNative()var use =
> R(module).use
> use('fs', 'node_modules/third/party', require('./smart-fs'))
>
> That's it. Third party module just uses our smart file system
>
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.