I’m using Javascript in my browser to control my Photon. I had a weird situation where a line of Javascript just went nowhere; I step over the line in Firebug and control never comes back. I tried it in Safari and the tools there warn of a possible unhandled rejection in spark.min.js. I’m not a Javascript guru - perhaps there is an odd condition in spark.min.js?
Here’s a bit of my pseudo code…
var devicesPr = spark.listDevices();
devicesPr.then(devicesPrTrue, devicesPrFalse);
devicesPrTrue(devices) calls
var devList = spark.devices;
I then iterate through each entry in the devList and use .id and .name to construct a drop down list for my user to choose.
It would help to see the actual code – there may be a subtle error that we can help you find. And even better if you can replicate the problem with some code that is as minimal as possible.
Thanks for the suggestions. I ran JSLint on my code and it suggested changing some of my code from this (which I like for readability)
I had something like this inside a closure in a devList.forEach loop…
output = 'Some stuff'
+ entry.id
+ 'yet more stuff';
into this structure…
output = 'Some stuff' +
entry.id +
'yet more stuff';
And when I did that the issue disappeared. Apparently JS parsers will insert semi-colons places they think they belong. Perhaps that was the source of the issue.