ソースを参照

inversify test

sanex3339 8 年 前
コミット
146ce61427

+ 3 - 2
dist/index.js

@@ -88,7 +88,7 @@ module.exports =
 /******/ 	__webpack_require__.p = "";
 /******/
 /******/ 	// Load entry module and return exports
-/******/ 	return __webpack_require__(__webpack_require__.s = 109);
+/******/ 	return __webpack_require__(__webpack_require__.s = 110);
 /******/ })
 /************************************************************************/
 /******/ ([
@@ -5315,7 +5315,8 @@ module.exports = require("is-equal");
 module.exports = require("mkdirp");
 
 /***/ },
-/* 109 */
+/* 109 */,
+/* 110 */
 /***/ function(module, exports, __webpack_require__) {
 
 "use strict";

+ 1 - 6
src/container/InversifyContainerFacade.ts

@@ -24,7 +24,6 @@ export class InversifyContainerFacade {
     constructor (options: IInputOptions) {
         this.container = new Container();
 
-        // IOptions
         this.container
             .bind<IOptions>(ServiceIdentifiers.IOptions)
             .toDynamicValue(() => {
@@ -32,24 +31,20 @@ export class InversifyContainerFacade {
             })
             .inSingletonScope();
 
-        // IObfuscator
         this.container
             .bind<IObfuscator>(ServiceIdentifiers.IObfuscator)
             .to(Obfuscator);
 
-        // IObfuscationEventEmitter
         this.container
             .bind<IObfuscationEventEmitter>(ServiceIdentifiers.IObfuscationEventEmitter)
             .to(ObfuscationEventEmitter)
             .inSingletonScope();
 
-        // IStackTraceAnalyzer
         this.container
             .bind<IStackTraceAnalyzer>(ServiceIdentifiers.IStackTraceAnalyzer)
             .to(StackTraceAnalyzer)
             .inSingletonScope();
 
-        // IStorage<ICustomNode>
         this.container
             .bind<IStorage<ICustomNode>>(ServiceIdentifiers.IStorage)
             .to(CustomNodesStorage)
@@ -60,7 +55,7 @@ export class InversifyContainerFacade {
      * @param serviceIdentifier
      * @returns {T}
      */
-    public get <T> (serviceIdentifier: interfaces.ServiceIdentifier<T>) {
+    public get <T> (serviceIdentifier: interfaces.ServiceIdentifier<T>): T {
         return this.container.get<T>(serviceIdentifier);
     }
 }

+ 4 - 2
src/container/ServiceIdentifiers.ts

@@ -1,4 +1,6 @@
-let ServiceIdentifiers = {
+import { IContainerServiceIdentifiers } from '../interfaces/IContainerServiceIdentifiers';
+
+let ServiceIdentifiers: IContainerServiceIdentifiers = {
     IObfuscationEventEmitter: Symbol('IObfuscationEventEmitter'),
     IObfuscator: Symbol('IObfuscator'),
     IOptions: Symbol('IOptions'),
@@ -6,4 +8,4 @@ let ServiceIdentifiers = {
     IStorage: Symbol('IStorage')
 };
 
-export { ServiceIdentifiers };
+export { ServiceIdentifiers };

+ 1 - 1
src/event-emitters/ObfuscationEventEmitter.ts

@@ -7,4 +7,4 @@ import { EventEmitter } from 'events';
 decorate(injectable(), EventEmitter);
 
 @injectable()
-export class ObfuscationEventEmitter extends EventEmitter implements IObfuscationEventEmitter {}
+export class ObfuscationEventEmitter extends EventEmitter implements IObfuscationEventEmitter {}

+ 10 - 0
src/interfaces/IContainerServiceIdentifiers.d.ts

@@ -0,0 +1,10 @@
+import { interfaces } from 'inversify';
+
+export interface IContainerServiceIdentifiers {
+    IObfuscationEventEmitter: interfaces.ServiceIdentifier<any>,
+    IObfuscator: interfaces.ServiceIdentifier<any>,
+    IOptions: interfaces.ServiceIdentifier<any>,
+    IStackTraceAnalyzer: interfaces.ServiceIdentifier<any>,
+    IStorage: interfaces.ServiceIdentifier<any>,
+    [key: string]: interfaces.ServiceIdentifier<any>
+}