Ready Decorator
Using the @ready()
decorator on a module method, invokes that method after the container bootstrap is complete.
As an example, when using the @init()
decorator on a method, the method invokes as part of the container bootstrap. The @ready()
decorator is for cases where you want to invoke a method when all modules initialization has complete.
Usage
You use the @ready()
decorator by decorating a module class method. This method is called by the Injex runtime after all the modules initialized and the bootstrap process has been complete.
Bootstrap complete syntactic sugar
The @ready()
decorator is a syntactic sugar to hooking a module method into the container bootstrapComplete
hook.
For example:
With @ready()
decorator:
Inheritance
You can use multiple @ready()
methods when you inherit from a parent class.
For example: