-
• #2
window
is web browser window when javascript runs as part of web page, do you really expect web browser to be runing inside the watch? tryglobal
see also https://javascript.info/global-object , it is same like in node.js -
• #3
Ah yes! I got confused between the usage. Tried out using global and that works perfectly as expected.
Thanks for your help! :D
Hi,
I am a relatively new user of the Bangle.js. I was playing around with the button and touch functionality of the watch in the emulator.
I am trying to declare a global variable inside of a function. I am aware that the way to do this in JavaScript is to prepend the variable declaration with the word 'window', like below:
window.a = 'abc';
When I try to do the same inside my code, it is giving me an "Uncaught ReferenceError: "window" is not defined" error message.
Am I missing something here? I have uploaded my code snippet for reference.
I would like to set my secondInterval variable to be a global one, so that it can be cleared from outside the function where it is defined.
Any help would be greatly appreciated.