iamjoncannon / nodeLOM

control Ableton Live from a Node.js server via web sockets
3 stars 0 forks source link

LOM.observeList[entry] is not a function #2

Open b1kjsh opened 5 years ago

b1kjsh commented 5 years ago

When I use this project in my own m4l device if I start up the server and then start my node.script

const LOM = require('./nodeLOM/LOM'); LOM.connect();

I get an error stating that LOM.observeList[entry] is not a function and then the server shows that my client disconnects.

It appears to be an issue with the following line of code from LOM.js

 if (obsOpen && data.type === 'observed' && !(data.prop === 'id')) {

      let entry = (data.path + data.prop).replace('"', '').replace('"', '').split(' ').join('');

      LOM.observeList[entry](data.value);  <--- I guess this isn't always a function maybe more filtering in the if statement is needed to fix this?

 }
burgessa23 commented 2 years ago

I got it running by changing to:

if (LOM.observeList[entry] && typeof LOM.observeList[entry] === 'function'){
          LOM.observeList[entry](data.value);
        }