-
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 redundant/verbose code in player.js #3597
refactor redundant/verbose code in player.js #3597
Conversation
I don't think the changes to player.js here are worth the limited savings. We lose an easy way to document the functions, plus, there's a performance and memory hit here since we're creating a new functions each time a player is created. The player is the most important class in the project so making sure that it's well documented is essential. |
we should still be able to document the methods, and I can add all of this to the prototype rather than in the constructor |
Tests passed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED Commit: 8599123d7af103dc2f90d8ee2be31556d6556be2 (Please note that this is a fully automated comment.) |
* | ||
* @event ended | ||
*/ | ||
Player.prototype.handleTechEnded_; // eslint-disable-line |
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.
this function actually exists
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.
Are we not losing the @event ended
here with this removal?
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.
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.
I think we should keep it but make sure it gets updated as part of #3630.
Tests passed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED Commit: 15cc4c0ef4da33471562a4f3ee34e8dd90dce4f2 (Please note that this is a fully automated comment.) |
Tests passed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED Commit: 37cd7780179df233f5a76d161bd8eb440eb497d2 (Please note that this is a fully automated comment.) |
Tests passed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED Commit: e1eaf4bdc7ec9310f81daf3b45473c1db48e69f5 (Please note that this is a fully automated comment.) |
/** | ||
* Fired when the player has initial duration and dimension information | ||
* | ||
* @event loadedmetadata | ||
* Player.prototype.handleLoadedMetaData_ |
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.
Missing @method
here?
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.
yeah good catch
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.
We probably don't want to have @method
here. We don't want these to show up as documentation. These stubs specifically are used to document the events that the player listens to but are otherwise private methods. Adding a @private
, I think, will then prevent the event from being displayed in the docs.
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.
going to add @Private
@gkatsev Made a good point. We should make sure that anything with a trailing underscore is marked as |
elTracks.addEventListener('removetrack', this[`handle${capitalType}TrackRemove_`]); | ||
this[`removeOld${capitalType}Tracks_`] = (e) => this.removeOldTracks_(techTracks, elTracks); | ||
|
||
// Remove (native) trackts that are not used anymore |
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 long as we're in here, the "trackts" typo could be fixed.
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.
nice catch
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.
This still needs an update.
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.
this was changed in the other PR #3593, and I will rebase it when it is merged
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.
Ah cool. Forgot that it included the other 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.
A few questions.
@@ -60,7 +140,6 @@ import './tech/html5.js'; | |||
* @param {Element} tag The original video tag used for configuring options | |||
* @param {Object=} options Object of option names and values | |||
* @param {Function=} ready Ready callback function | |||
* @extends Component |
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.
does this get picked up automatically?
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.
yeah from my testing with jsdoc it does
*/ | ||
Player.prototype.handleLoadedMetaData_; // eslint-disable-line |
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.
you don't need the method stub for jsdoc to pick this up?
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.
no you don't, jsdoc assumes that it is a dynamic method
/** | ||
* Fired when the player has initial duration and dimension information | ||
* | ||
* @event loadedmetadata | ||
* @private |
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.
does @private
still keep the events in the doc output?
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.
let me double check
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.
no id does not keep the events in the docs, and it seems like our event format may even be off http://usejsdoc.org/tags-event.html
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.
Might be the old format or something? I would vote for removing the @private
and filing a separate issue for fixing the @event
doclets.
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.
yeah it seems like @event
should be it's own seperate tag, it does not show up even with @private
removed I think that we just need lots of documentation updates at this point
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.
this seems to be format that we would want it in, although it still looks a bit strange when I generate the docs, I think we need to do any more documentation changes/updates in another PR
/**
* Fires loadedmetadata from the tech
*
* @fires Player#loadedmetadata
* @method Player.prototype.handleLoadedMetaData_
* @private
*/
/**
* Fired when the player has initial duration and dimension information
*
* @event Player#loadedmetadata
* @type {Event}
*/
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.
Sounds good. Want to open a new issue with that?
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.
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.
LGTM.
Test fails because of the firefox issue.
fixing doc block (should not have ended in ?)
Description
Requirements Checklist
ToDo
Find a way to generate documentation for all the methods that are now dynamic, without compromising on the size of video.js