mariocasciaro / scatter

IoC container and out-of-the-box extensibility for Node.js applications
MIT License
154 stars 14 forks source link

Question about the particles system #37

Closed clooudch closed 8 years ago

clooudch commented 8 years ago

I am wondering why the particles system in scatter exists. Because you really do not need it:

For example if i have a particle with the name "core" inside the "project" dir :

Now if i want to load the "module" module. I will have the following code inside the "index.js"

// Load other modules
var Scatter = require("scatter");
var path = require("path");

// Create the scatter container
var scatter = new Scatter();

// Define the node modules 
scatter.setNodeModulesDir(path.join(__dirname, "node_modules"));

// Register the particles
scatter.registerParticles([
        path.join(__dirname, "core")
    ]);

// Load the module
scatter.load("module").then(function() {   // I think here u should write core/module 
    console.log("Loaded the module");
});

It would be more logicaly if i have to specify the pratcile i am loading that module from while loading it. So rather than loading "module" it should be "core/module"

So why do i need the particles system then? It doesnt help me to organize my code, Or did i misunderstood something?