Closed clach04 closed 8 years ago
I opened an issue with Pebble and they confirmed that there is a problem here, really there are two problems:
Full text from Pebble support below:
The development team have managed to find the cause of the issue:
JSError: SyntaxError: Unexpected identifier ( pebble-js-app.js @ 2184 : 19 ) -> for (var mapping of mappings)
The issue is OpenHAB is using ES6 syntax which is not formally supported by CloudPebble, Pebble.js, nor the PebbleKit JS VMs on Android and iOS
The issue behind finding the error so slowly was strangely pyv8 not placing the stack trace in e.stackTrace, although I do eventually want to support it in Pebble.js through the use of translators.
I hope this helps you resolve your issue.
So... what are people supposed to use in place of for..of? In any event, it seems to work fine as is. I've updated the code to use the 'for (var foo of bar)' syntax (i.e. inserting the keyword 'var' to make jshint and the IDE happy).
I've uploaded a new version 1.1 of the app to the pebble app store. It has various minor fixes that may solve your issues. Please try it out and report back.
No luck with Pebble Time device with firmware version 3.8.2 (with version 1.1 in pebble store).
Hmm... odd. using the same versions and it works for me. What version of iOS are you using?
Android not iOS.
Just tried v1.1 in the emulator on CloudPebble,.v1.1 builds now that issues #4 is resolved :) However it is not working/running on Android nor the CloudPebble emulator with v3.8 of Pebble OS.
What platforms/versions is this working on for you?
This is caused by the "for .. of" syntax, adding the var' deceleration will not resolve this. It isn't clear to me that ES6 support is coming from Pebble so replacing the for..of with an alternative seems the best bet (e.g. "for..in", I'm not clear if forEach is supported, I've not checked).
I'm using iOS v 9.0.2, Pebble Time, watch os v 3.8.2, phone app v 3.5. Per this ES6 compatibility matrix, (https://kangax.github.io/compat-table/es6/) the iOS 8.x and 9.x javascript engines seem to support the for..of construct.
So... what version of Android are you running? It appears from the compatibility matrix that Android v 5.1 has support for for...of loops.
If you have alternative suggestions for the for...of loop, please submit a pull request.
I guess the replacement of
for (c of a) { ... }
is
for(var i in a) { c = a[i]; .... }
correct?
That was the replacement I was thinking of.
I may be mistaken but I do not think Pebble Phone app uses the Android OS provided javascript engine. I believe Pebble are statically building in That was the replacement I was thinking of.
I may be mistaken but I don't think Pebble Phone app uses the Android OS provided javascript engine. I believe Pebble are building in a js engine into the Pebble phone app.
Pretty sure that on iOS, apps aren't allowed to build in their own interpreters, and that they must use the system provided ones. Anyway, I will try changing the for..of to for..in tomorrow and see if it works ok on iOS. You'll still have to test on android.
Sounds good, I can test both on Android and the CloudPebble emulator.
pushed version 1.2 to pebble store with the for-in change. please try on android.
@llamahunter woot! Works on Android (and works better on CloudPebble)
See on Pebble Time device with firmware version 3.8.2 (with version 1.0 in pebble store https://apps.getpebble.com/en_US/application/5542604d45bf334314000098?section=watchapps). And current code in https://cloudpebble.net on both Aplite and Basalt.
Pebble screen is blank and then after a few secs displays:
Debug logging shows:
NOTE to run in current emulator appinfo.json needs updating - see issue #4