diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Injector.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Injector.js b/src/Injector.js index 94154bec..f5e35d0f 100644 --- a/src/Injector.js +++ b/src/Injector.js @@ -429,12 +429,15 @@ function createInjector(modulesToLoad) { } } - function instantiate(Type, locals){ - var Constructor = function(){}, - instance; + function instantiate(Type, locals) { + var Constructor = function() {}, + instance, returnedValue; + Constructor.prototype = Type.prototype; instance = new Constructor(); - return invoke(Type, instance, locals) || instance; + returnedValue = invoke(Type, instance, locals); + + return isObject(returnedValue) ? returnedValue : instance; } return { |
