Callbacks via EventEmitter + possible memory leak fix

This commit is contained in:
Adhiraj Singh
2020-10-28 16:10:28 +05:30
parent 159b6d5cf5
commit cc722a5138
8 changed files with 106 additions and 161 deletions

View File

@@ -123,7 +123,7 @@ async function example() {
})
/* example of custom functionality for tracking battery */
conn.registerCallback(['action', null, 'battery'], json => {
conn.on('CB:action,,battery', json => {
const batteryLevelStr = json[2][0][1].value
const batterylevel = parseInt(batteryLevelStr)
console.log('battery level: ' + batterylevel)