-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reworked the example to address some design issues #1
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.