-
Couldn't load subscription status.
- Fork 54
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Wechaty Puppet v0.49 and the previous version, we need to implement the start() and stop() on child class, and we need to manage the state by ourselves, like:
Lines 138 to 142 in e76d675
| if (this.state.on()) { | |
| log.warn('Puppet', 'start() found that is starting/statred...') | |
| await this.state.ready('on') | |
| log.warn('Puppet', 'start() found that is starting/statred... done') | |
| return |
From v0.51, we can reuse those codes from the abstract base class, and we can put all our function code in onStart() and onStop(), without care about the state anymore.
The start() and stop() method in the Puppet abstract base class will take care of the state and call onStart() and onStop for you.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request