08-25-2019 04:54
08-25-2019 04:54
While I am able to create events inside index.js of the companion, I am not able to do so within index.js of the app itself. What am I missing?
index.js:
console.log('Up and running.'); var event = new Event('test'); console.log('Event added.')
console output:
[1:45:51 PM] App: App Closed [1:45:51 PM] App: App Started [1:45:51 PM] App: Up and running. (app/index.js:1,1) [1:45:51 PM] App: Unhandled exception: ReferenceError: Event is not defined event at app/index.js:3,1 [1:45:52 PM] Companion: Up and running. (companion/index.js:1,1) [1:45:52 PM] Companion: Event added. (companion/index.js:5,1)
I am using the following versions of the sdk:
08-25-2019 13:42
08-25-2019 13:42
Two probably-wrong guesses:
08-26-2019 10:54
08-26-2019 10:54
@Gondwana wrote:You may not be importing the right file.
There's no need to import anything inside index.js of the companion to make use of the Event class there, so I'd doubt that.
@Gondwana wrote:The device runs an older version of javascript, so some things that work on the companion don't work on the watch.
I guess so, too. On a different thread I recently read about restricted capabilities of the device regarding date methods like "toLocaleString()". JonFitbit stated the following cause there: "The JavaScript on the device only supports ES5.1, ..." Gonna stick to callbacks then, I'm afraid... /:
03-16-2020 11:57
03-16-2020 11:57
Try this: