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

refactor player.hasStarted() #4680

Merged
merged 4 commits into from
Oct 31, 2017
Merged

refactor player.hasStarted() #4680

merged 4 commits into from
Oct 31, 2017

Conversation

kocoten1992
Copy link
Contributor

@kocoten1992 kocoten1992 commented Oct 22, 2017

update doc on hasStarted()

I feel 'request' are more suitable than hasStarted (as a variable) because when I do "if (request === undefined)", it mean if you don't have any request, then we just return current status, it a bit more clear

Requirements Checklist

  • Docs/guides updated

update doc on hasStarted()

I feel 'request' are more suitable than hasStarted (variable) because when I do "if (request === undefined)", it mean if you don't have any request, then we just return current status, it a bit more clear
@kocoten1992
Copy link
Contributor Author

Hi @gkatsev , does this style of writing clearer than the previous one.

Cause I'm running through the source and see a lot of js write at old style, if this pull request accepted, I might refactor some more ?

Copy link
Member

@gkatsev gkatsev left a comment

Choose a reason for hiding this comment

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

Thanks @kocoten1992. We do have a lot of code that we just ported over and didn't refactor. Only had a couple of small comments on this, overall it's a good change.

src/js/player.js Outdated
* the boolean value of hasStarted_
*/
hasStarted(request) {
if (request === undefined || request === this.hasStarted_) {
Copy link
Member

Choose a reason for hiding this comment

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

A comment explaining that this is used as a getter or if the value isn't changing, we should just return what we have would be good

src/js/player.js Outdated
this.removeClass('vjs-has-started');
}

return this.hasStarted_;
Copy link
Member

Choose a reason for hiding this comment

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

Our setters generally do not return anything.

Copy link
Member

Choose a reason for hiding this comment

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

As @gkatsev said, this is my only concern with the PR.

src/js/player.js Outdated
this.removeClass('vjs-has-started');
}

return this.hasStarted_;
Copy link
Member

Choose a reason for hiding this comment

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

As @gkatsev said, this is my only concern with the PR.

Copy link
Member

@gkatsev gkatsev left a comment

Choose a reason for hiding this comment

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

Thanks @kocoten1992! Looking forward to more PRs :D

Copy link
Member

@misteroneill misteroneill left a comment

Choose a reason for hiding this comment

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

What he said. Thank you!

@gkatsev gkatsev merged commit cde8335 into videojs:master Oct 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants