Skip to content
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

Buffer time-display component values to avoid refreshing HTML too often #3101

Closed
wants to merge 2 commits into from

Conversation

Naouak
Copy link
Contributor

@Naouak Naouak commented Feb 10, 2016

HTML reparsing is a costly action for the browser and these components need to be updated only once per second. To avoid getting updating too often the HTML, the HTML will only update if the input data change.

@@ -55,7 +55,10 @@ class CurrentTimeDisplay extends Component {
let time = (this.player_.scrubbing()) ? this.player_.getCache().currentTime : this.player_.currentTime();
let localizedText = this.localize('Current Time');
let formattedTime = formatTime(time, this.player_.duration());
this.contentEl_.innerHTML = `<span class="vjs-control-text">${localizedText}</span> ${formattedTime}`;
if(formattedTime !== this.formattedTime_){
Copy link
Member

Choose a reason for hiding this comment

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

needs whitespace after if and before {, in remaining-time-display as well.

@gkatsev
Copy link
Member

gkatsev commented Feb 10, 2016

Thanks. This makes sense to me. Just needs a minor stylistic update.

@gkatsev gkatsev added minor This PR can be added to a minor release. It should not be added to a patch release. needs: LGTM Needs one or more additional approvals labels Feb 10, 2016
@dmlap
Copy link
Member

dmlap commented Feb 18, 2016

LGTM

@gkatsev gkatsev added confirmed and removed needs: LGTM Needs one or more additional approvals labels Feb 18, 2016
@gkatsev gkatsev closed this in 0490728 Feb 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed minor This PR can be added to a minor release. It should not be added to a patch release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants