Skip to content

Commit

Permalink
version up
Browse files Browse the repository at this point in the history
  • Loading branch information
longlh committed Aug 21, 2017
1 parent 3a54f21 commit 5b84d21
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 18 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "di-linker",
"version": "2.1.1",
"version": "2.1.5",
"homepage": "https://github.com/longlh/di-linker",
"authors": [
"Luc Hoang Long <d@dapps.me>"
Expand Down
15 changes: 12 additions & 3 deletions dist/di-linker.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ var Context = module.exports = function(requireFunc) {
this._container = {};
this._requireIndicator = '@';
this._config = {
verboseLog: false
verboseLog: false,
allowReRegister: false
};

// register some build-in dependencies
Expand All @@ -51,7 +52,10 @@ var proto = Context.prototype;
proto.config = function(config) {
this._config = _
.chain(config)
.pick(['verboseLog'])
.pick([
'verboseLog',
'allowReRegister'
])
.defaults(this._config)
.value();

Expand All @@ -60,8 +64,9 @@ proto.config = function(config) {

proto.register = function(def) {
var dependency = new Dependency(def);
var allowReRegister = !!(this._config && this._config.allowReRegister);

if (this._container[dependency.name]) {
if (!allowReRegister && this._container[dependency.name]) {
throw new Error('Dependency [' + dependency.name + '] has been registered!');
}

Expand Down Expand Up @@ -23078,6 +23083,10 @@ process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.prependListener = noop;
process.prependOnceListener = noop;

process.listeners = function (name) { return [] }

process.binding = function (name) {
throw new Error('process.binding is not supported');
Expand Down
6 changes: 1 addition & 5 deletions dist/di-linker.min.js

Large diffs are not rendered by default.

15 changes: 12 additions & 3 deletions dist/di-linker.standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ var Context = module.exports = function(requireFunc) {
this._container = {};
this._requireIndicator = '@';
this._config = {
verboseLog: false
verboseLog: false,
allowReRegister: false
};

// register some build-in dependencies
Expand All @@ -51,7 +52,10 @@ var proto = Context.prototype;
proto.config = function(config) {
this._config = _
.chain(config)
.pick(['verboseLog'])
.pick([
'verboseLog',
'allowReRegister'
])
.defaults(this._config)
.value();

Expand All @@ -60,8 +64,9 @@ proto.config = function(config) {

proto.register = function(def) {
var dependency = new Dependency(def);
var allowReRegister = !!(this._config && this._config.allowReRegister);

if (this._container[dependency.name]) {
if (!allowReRegister && this._container[dependency.name]) {
throw new Error('Dependency [' + dependency.name + '] has been registered!');
}

Expand Down Expand Up @@ -23078,6 +23083,10 @@ process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.prependListener = noop;
process.prependOnceListener = noop;

process.listeners = function (name) { return [] }

process.binding = function (name) {
throw new Error('process.binding is not supported');
Expand Down
6 changes: 1 addition & 5 deletions dist/di-linker.standalone.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "di-linker",
"version": "2.1.4",
"version": "2.1.5",
"description": "A lightweight Dependency Injection for Javascript",
"main": "./core/node-factory.js",
"repository": {
Expand Down

0 comments on commit 5b84d21

Please sign in to comment.