comparison src/implab/di/ServiceDescriptor.js @ 1:93fb6c09f2e1

minor fixes
author cin
date Fri, 02 Jun 2017 18:15:22 +0300
parents fc2517695ee1
children 00779cb63b12
comparison
equal deleted inserted replaced
0:fc2517695ee1 1:93fb6c09f2e1
1 define( 1 define(
2 [ 2 [
3 "dojo/_base/declare", 3 "../declare",
4 "../safe", 4 "../safe",
5 "dojo/_base/lang",
6 "dojo/_base/array",
7 "./Descriptor", 5 "./Descriptor",
8 "./ValueDescriptor" 6 "./ValueDescriptor"
9 ], 7 ],
10 8
11 function (declare, safe, lang, array, Descriptor, Value) { 9 function (declare, safe, Descriptor, Value) {
12 var SINGLETON_ACTIVATION = 1, 10 var SINGLETON_ACTIVATION = 1,
13 CONTAINER_ACTIVATION = 2, 11 CONTAINER_ACTIVATION = 2,
14 CONTEXT_ACTIVATION = 3, 12 CONTEXT_ACTIVATION = 3,
15 CALL_ACTIVATION = 4, 13 CALL_ACTIVATION = 4,
16 HIERARCHY_ACTIVATION = 5; 14 HIERARCHY_ACTIVATION = 5;
218 this._factory = function () { 216 this._factory = function () {
219 return new ctor(); 217 return new ctor();
220 }; 218 };
221 } else if (this._params instanceof Array) { 219 } else if (this._params instanceof Array) {
222 this._factory = function () { 220 this._factory = function () {
223 var inst = lang.delegate(ctor.prototype); 221 var inst = safe.create(ctor.prototype);
224 var ret = ctor.apply(inst, arguments); 222 var ret = ctor.apply(inst, arguments);
225 return typeof (ret) === "object" ? ret : inst; 223 return typeof (ret) === "object" ? ret : inst;
226 }; 224 };
227 } else { 225 } else {
228 this._factory = function (param) { 226 this._factory = function (param) {
242 this._params, 240 this._params,
243 ".params")); 241 ".params"));
244 } 242 }
245 243
246 if (this._inject) { 244 if (this._inject) {
247 array.forEach(this._inject, function (spec) { 245 this._inject.forEach(function (spec) {
248 for (var m in spec) 246 for (var m in spec)
249 injectMethod(instance, m, context, spec[m]); 247 injectMethod(instance, m, context, spec[m]);
250 }); 248 });
251 } 249 }
252 250