10-03-2017 01:07
10-03-2017 01:07
Hi All,
I have followed the settings guide as shown on https://dev.fitbit.com/guides/settings/ and every time I change a colour in the companion app I get the following error in the console:
TypeError: undefined is not an object (evaluating 'evt.data.key') onchange at companion/index.js:10
A screenshot of my companion index.js is below:
as you can see, I added some console logs to see check the code was being called. Prior to me adding lines 9 and 10, the same error occurred on line 11.
Any ideas?
Answered! Go to the Best Answer.
Best Answer10-03-2017 09:14 - edited 10-03-2017 09:15
10-03-2017 09:14 - edited 10-03-2017 09:15
ok, so after much playing around the following seems to work:
console.log(evt.key + " - " + evt.newValue);
although now I am getting all kinds of other errors. I will persevere ...
Best Answer10-03-2017 01:17
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
10-03-2017 01:17
Can you try:
console.log(JSON.stringify(evt.data))
Then see what you're receiving.
Best Answer10-03-2017 01:45
10-03-2017 01:45
Hi Jon
Console says :
Best Answer10-03-2017 02:40
10-03-2017 02:40
Not sure if this makes a difference but I have configured this as an app (not a clock face)
Best Answer10-03-2017 02:42
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
10-03-2017 02:42
Apps and clocks are the same, but you can only have 1 clock and clocks can't use buttons.
What happens if you log the contents of evt?
console.log(JSON.stringify(evt))
Best Answer10-03-2017 03:00
10-03-2017 03:00
Similar error but empty braces this time:
Best Answer10-03-2017 03:29
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
10-03-2017 03:29
Very strange, can I see your settings.jsx?
Best Answer10-03-2017 04:56
10-03-2017 04:56
Here you are
Best Answer10-03-2017 09:14 - edited 10-03-2017 09:15
10-03-2017 09:14 - edited 10-03-2017 09:15
ok, so after much playing around the following seems to work:
console.log(evt.key + " - " + evt.newValue);
although now I am getting all kinds of other errors. I will persevere ...
Best Answer