Reworked the example to address some design issues#1
Reworked the example to address some design issues#1gaperton wants to merge 1 commit intoFitbit:masterfrom
Conversation
|
This looks great, thanks for your contribution! |
| let btn = document.getElementById("v1-button"); | ||
| btn.addEventListener("click", clickHandler); | ||
| } | ||
| export function initialize( views, options ){ |
There was a problem hiding this comment.
Might be neater and less prone to typos to use the default export?
| /** | ||
| * Open view-2 as subview and pass granularity as a parameter. | ||
| */ | ||
| btn3.addEventListener( "click", evt => { |
There was a problem hiding this comment.
nit: Spacing on the arguments looks a bit odd on the event handlers here compared to other files
| return () => { | ||
| // Unsubscribe from clock. | ||
| clock.granularity = "off"; | ||
| clock.ontick = void 0; |
There was a problem hiding this comment.
In an example, this particular syntax is likely to confuse some folks. Perhaps stick to just undefined?
| viewSelected: () => viewSelected | ||
| }; | ||
| /** Open the view as subview, so back button can be used to navigate back */ | ||
| open( viewName, options ){ |
There was a problem hiding this comment.
nit: perhaps push would be a more descriptive name here? To me, open vs replace isn't super clear about the difference between the two.
|
Sorry for the delay. I've just merged the DCO and licence. Can you sign your commit as per https://dev.fitbit.com/community/contributing/. Thanks for an awesome contribution! |
I like the way how this example works, an ability to load views dynamically is amazing feature of SDK 4.0. I made some touches to this example to address common design problems developer will experience when he will try to use it in a real app.
open()andback()methods, and automatic handling of the BACK button.Now it's basically a quite useful microframework and project starter, not just a feature example.