Skip to content

nwire no longer needs a callback

Compare
Choose a tag to compare
@divmgl divmgl released this 07 Feb 22:50
· 25 commits to master since this release
// 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 the consumer package. With older versions of nwire, 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.