added new "last message" logic, before useReducer

This commit is contained in:
canove
2020-06-17 09:03:44 -03:00
parent 794a217a4e
commit 48ee6385d3
9 changed files with 140 additions and 85 deletions

View File

@@ -13,7 +13,7 @@ const wbotMonitor = () => {
const wbot = getWbot();
wbot.on("change_state", newState => {
console.log(newState);
console.log("monitor", newState);
});
wbot.on("change_battery", batteryInfo => {
@@ -27,7 +27,10 @@ const wbotMonitor = () => {
wbot.destroy();
setTimeout(() =>
init()
.then(res => wbotMessageListener(), 2000)
.then(res => {
wbotMessageListener();
wbotMonitor();
})
.catch(err => console.log(err))
);
});