Skip to content

adding a story for rh-datetime#50

Merged
mwcz merged 3 commits intomasterfrom
rh-datetime-story
Jul 17, 2018
Merged

adding a story for rh-datetime#50
mwcz merged 3 commits intomasterfrom
rh-datetime-story

Conversation

@kylebuch8
Copy link
Copy Markdown
Contributor

No description provided.


function timer() {
document.getElementById("realtime").setAttribute("datetime", new Date());
window.requestAnimationFrame(timer);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be better as a setInterval every second. As written it's equivalent to a setInterval every 16 milliseconds; all that rAF adds is synchronizing the interval to match the screen's refresh rate.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But rAF makes sure that the timer is super accurate.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like overkill to me but in a story it's not that big a deal. If it were in the component itself I'd urge setInterval or a throttle within rAF.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, let's roll with it.

Copy link
Copy Markdown
Contributor

@mwcz mwcz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lord Gawd Take Me

@mwcz mwcz merged commit a334a76 into master Jul 17, 2018
@mwcz mwcz deleted the rh-datetime-story branch July 17, 2018 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants