Skip to content

Commit

Permalink
fix adapter start
Browse files Browse the repository at this point in the history
  • Loading branch information
oweitman committed Nov 25, 2024
1 parent 6611a96 commit 60053be
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 94 deletions.
25 changes: 8 additions & 17 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class Openligadb extends utils.Adapter {
});
this.on('ready', this.onReady.bind(this));
// @ts-expect-error statechange doesnt exist
this.on('stateChange', this.onStateChange.bind(this));
this.on('unload', this.onUnload.bind(this));
this.on('message', this.onMessage.bind(this));
}
Expand Down Expand Up @@ -66,24 +65,16 @@ class Openligadb extends utils.Adapter {
}
}
/**
* Is called if a subscribed state changes
* Handle messages from other adapters.
*
* @param id {string} The subscribed ID
* @param state {string|number|boolean} The new state
* @param obj {object}
* @param obj.message {string} 'getMatchData'
* @param obj.data {object}
* @param obj.data.shortcut {string}
* @param obj.data.season {string}
* @param obj.data.datefrom {string} ISO notation
* @param obj.data.datetill {string} ISO notation
*/
onStateChange(id, state) {
if (state) {
// The state was changed
// @ts-expect-error val dont exist
this.log.debug(`state ${id} changed: ${state.val} (ack = ${state.ack})`);
if (openligadbserver) {
openligadbserver.doStateChange(id, state);
}
} else {
// The state was deleted
this.log.debug(`state ${id} deleted`);
}
}
onMessage(obj) {
if (typeof obj === 'object' && obj.message) {
openligadbserver.processMessages(obj);
Expand Down
77 changes: 0 additions & 77 deletions openligadb.js

This file was deleted.

0 comments on commit 60053be

Please sign in to comment.