Binding 'this' object to some subfunctions

This commit is contained in:
Chris Troutner
2024-04-20 07:14:17 -07:00
parent 60a3d67c0b
commit 425d2ada65
2 changed files with 9 additions and 1 deletions
+7
View File
@@ -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.
+2 -1
View File
@@ -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) {