Browse the code of these fully-functionning UWA widgets to understand their inner workings.
To get to the code, select the standalone version of the widget you are interested in, and display its code through your browser's appropriate option.