diff --git a/src/controllers/index.js b/src/controllers/index.js index 117de46..12f91ac 100644 --- a/src/controllers/index.js +++ b/src/controllers/index.js @@ -21,6 +21,13 @@ class Controllers { this.useCases = new UseCases({ adapters: this.adapters }) this.timerControllers = new TimerControllers({ adapters: this.adapters, useCases: this.useCases }) this.config = config + + // Bind 'this' object to all subfunction + this.initAdapters = this.initAdapters.bind(this) + this.initUseCases = this.initUseCases.bind(this) + this.attachRESTControllers = this.attachRESTControllers.bind(this) + this.attachControllers = this.attachControllers.bind(this) + this.attachRPCControllers = this.attachRPCControllers.bind(this) } // Spin up any adapter libraries that have async startup needs. diff --git a/src/controllers/rest-api/index.js b/src/controllers/rest-api/index.js index 63e18a6..c6dbf22 100644 --- a/src/controllers/rest-api/index.js +++ b/src/controllers/rest-api/index.js @@ -29,7 +29,8 @@ class RESTControllers { ) } - // console.log('Controllers localConfig: ', localConfig) + // Bind 'this' object to all subfunctions. + this.attachRESTControllers = this.attachRESTControllers.bind(this) } attachRESTControllers (app) {