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

perf: only update ui on change, wrap things in requestAnimationFrame #6155

Merged
merged 6 commits into from
Aug 29, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/js/control-bar/progress-control/load-progress-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ class LoadProgressBar extends Component {
*/
createEl() {
const el = super.createEl('div', {className: 'vjs-load-progress'});
const wrapper = super.createEl('span', {className: 'vjs-control-text'});
const loadedText = super.createEl('span', {textContent: this.localize('Loaded')});
const wrapper = Dom.createEl('span', {className: 'vjs-control-text'});
const loadedText = Dom.createEl('span', {textContent: this.localize('Loaded')});
const separator = document.createTextNode(': ');

this.percentageEl_ = super.createEl('span', {
this.percentageEl_ = Dom.createEl('span', {
className: 'vjs-control-text-loaded-percentage',
textContent: '0%'
});
Expand Down Expand Up @@ -100,12 +100,12 @@ class LoadProgressBar extends Component {
}

// only update if changed
if (part.start_ === start && part.end_ === end) {
if (part.dataset.start === start && part.dataset.end === end) {
Copy link
Member

Choose a reason for hiding this comment

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

suprisingly, IE11 keeps having more support for features than I'd expect 😆.

continue;
}

part.start_ = start;
part.end_ = end;
part.dataset.start = start;
part.dataset.end = end;

// set the percent based on the width of the progress bar (bufferedEnd)
part.style.left = percentify(start, bufferedEnd);
Expand Down