@loke/di-ioc
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -21,2 +21,4 @@ 'use strict'; | ||
class Router { | ||
static FUNCTION_CALL = Symbol('function-call'); | ||
static CONSTRUCTOR_CALL = Symbol('constructor-call'); | ||
/** | ||
@@ -330,3 +332,6 @@ * Creates a new Router | ||
if (typeof newInstance !== 'object' || newInstance === null) { | ||
if ( | ||
(typeof newInstance !== 'object' || newInstance === null) && | ||
typeof newInstance !== 'function' | ||
) { | ||
emitter.emit('service-unproxyable', { name: longName.join('.') }); | ||
@@ -347,2 +352,24 @@ return newInstance; | ||
}, | ||
apply: (target, thisArg, args) => { | ||
if (!accessedProps.has(super.FUNCTION_CALL)) { | ||
accessedProps.add(super.FUNCTION_CALL); | ||
emitter.emit('service-used', { | ||
name: longName.join('.'), | ||
prop: Router.FUNCTION_CALL, | ||
}); | ||
} | ||
return Reflect.apply(target, thisArg, args); | ||
}, | ||
construct: (target, args) => { | ||
if (!accessedProps.has(super.CONSTRUCTOR_CALL)) { | ||
accessedProps.add(super.CONSTRUCTOR_CALL); | ||
emitter.emit('service-used', { | ||
name: longName.join('.'), | ||
prop: Router.CONSTRUCTOR_CALL, | ||
}); | ||
} | ||
return Reflect.construct(target, args); | ||
}, | ||
}); | ||
@@ -349,0 +376,0 @@ }; |
{ | ||
"name": "@loke/di-ioc", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Node.js dependency injection.", | ||
@@ -12,3 +12,3 @@ "main": "lib/index.js", | ||
"engines": { | ||
"node": ">=6.0.0" | ||
"node": ">=18.0.0" | ||
}, | ||
@@ -22,3 +22,3 @@ "author": "Anthony Foster + LOKE", | ||
"devDependencies": { | ||
"eslint": "^4.8.0", | ||
"eslint": "^8.34.0", | ||
"expect": "^1.20.2", | ||
@@ -25,0 +25,0 @@ "mocha": "^3.2.0", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19110
467