-
• #2
All properties/functions of a widget are globally available as
WIDGETS.widgetname.property
, for example my widget has functionsetClockError
which is available asWIDGETS.adjust.setClockError(x)
.The reason is that certain processes should not be interrupted when the user presses the button to go to the setting screen.
All widgets are stopped and restarted when user goes to settings screen, just like when user changes to any other app. (Settings is just one of the apps.)
-
• #3
Some code for an example. If you define your widget as
WIDGETS.mywidget = { area: ..., draw: ..., width: ..., someVariable: 123, someFunction: () => { ... }, };
Then in your clock, after calling
Bangle.loadWidgets()
, you can useWIDGETS.mywidget.someVariable
andWIDGETS.mywidget.someFunction()
. -
• #4
All widgets are stopped and restarted when user goes to settings
screen, just like when user changes to any other app. (Settings is
just one of the apps.)Ha! ok so my strategy is not the right one. Thanks for the quick response and relevant information.
I'm working on a small project and I would like to know if there is an elegant way to exchange information between a widget and a clock face. I need to run part of my program in the background, so in a widget, but I would like to display information in the clock face.
The reason is that certain processes should not be interrupted when the user presses the button to go to the setting screen.
Is there a way to declare global variables between apps and widgets.
thank you