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.
10-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 ...
10-03-2017 01:17
10-03-2017 01:17
Can you try:
console.log(JSON.stringify(evt.data))
Then see what you're receiving.
10-03-2017 01:45
10-03-2017 01:45
Hi Jon
Console says :
10-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)
10-03-2017 02:42
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))
10-03-2017 03:00
10-03-2017 03:00
Similar error but empty braces this time:
10-03-2017 03:29
10-03-2017 03:29
Very strange, can I see your settings.jsx?
10-03-2017 04:56
10-03-2017 04:56
Here you are
10-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 ...