-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Conversation
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
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 ? |
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.
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_) { |
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.
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_; |
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.
Our setters generally do not return anything.
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.
As @gkatsev said, this is my only concern with the PR.
src/js/player.js
Outdated
this.removeClass('vjs-has-started'); | ||
} | ||
|
||
return this.hasStarted_; |
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.
As @gkatsev said, this is my only concern with the PR.
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.
Thanks @kocoten1992! Looking forward to more PRs :D
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.
What he said. Thank you!
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