Closed jogibear9988 closed 5 years ago
do we have a ES6 template in generator? as long as we don‘t have i would leave it open
@jogibear9988 I have a small update for the constructor. Since you pioneered the ES6 classes, could you please test if the following works as the adapter constructor? You might need to rename the methods to _ready
and so on.
constructor(options) {
Object.assign(options, {
name: 'test-adapter',
});
super(options);
// After the super call, overwrite the methods on the options object
Object.assign(options, {
ready: this.onReady.bind(this),
objectChange: this.onObjectChange.bind(this),
stateChange: this.onStateChange.bind(this),
// message: this.onMessage.bind(this),
unload: this.onUnload.bind(this),
});
}
I wanted to avoid using events, so we can (for example) make use of this PR
https://github.com/ioBroker/ioBroker.js-controller/pull/316
which allows the unload
method to just be an async
method instead of having to call the callback.
This is obsolete now.
Superseded by #32 and #33 - should be closed @Apollon77