nwire no longer needs a callback
// config.js
module.exports = {
"consumer": { needs: ["provider"], fn: function(imports) { return imports.provider; } },
"provider": { needs: [], fn: function() { return 123; } }
}
// app.js
var app = require('nwire')(require('./config'));
console.log(app.consumer); // => 123
- Callbacks are no longer needed to return a container
- The
provider
package is declared after theconsumer
package. With older versions ofnwire
, this configuration would not have worked because the packages were resolved in sequential order. This has now been solved using ES5 getters.
The downside to this is that nwire no longer takes care of circular dependencies gracefully. Circular dependency detection may be added in a future release.