CodeCoupler UI Async Contructor Pattern
This class is uesed internally. Normally you never have to use this.
Classes derived from here can initiated with
Classes derived from here have to implement their asynchronous initialisation procedure within an method "init":
1 2 3 4 5
You can implement an additional method
async prepare if you need to do things before
called. Depending on the return value the following action will be taken:
- If you return here
initwill not be executed.
- If you return something different from
initializedresolves to this returned value and
initwill not be executed. So a
await x = new Something().initializedwill result to this value as new instance.
Please keep in mind, that if you use a
prepare method that could eventually return another
instance you should instruct the users to reassign the variable if not using the oneliner:
The first line would just return a new instatiated class, but the second line would return the instance you have specified with the method "prepare".