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

Restorations and Removals #2406

Closed
wants to merge 11 commits into from
Closed

Conversation

misteroneill
Copy link
Member

Closes #2405 by restoring several properties/methods for 5.0. Follows on from the discussion in #2402.

@misteroneill misteroneill changed the title Restorations Restorations and Removals Jul 24, 2015
@misteroneill misteroneill changed the title Restorations and Removals Restorations and Removals - NOT READY Jul 24, 2015
@misteroneill misteroneill changed the title Restorations and Removals - NOT READY Restorations and Removals Jul 24, 2015
*
* @type {Function}
*/
videojs.EventTarget = EventEmitter;
Copy link
Member

Choose a reason for hiding this comment

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

if we are changing EventEmitter to EventTarget, I'd prefer to just rename it internally as well and not just on export.

@heff
Copy link
Member

heff commented Jul 25, 2015

Very nice. Thanks for cleaning up the old deprecations.

+1 on Gary's comment

I think we should also deprecate round and export roundFloat by that name.

@gkatsev
Copy link
Member

gkatsev commented Jul 25, 2015

Is roundFloat really necessary? Of the usecases I've seen in the codebase, 95% of it is solved by the built in Number#toFixed.

@heff
Copy link
Member

heff commented Jul 25, 2015

Ha, no, probably not. I doubt anyone's using it anyway.

Sent from mobile

@gkatsev
Copy link
Member

gkatsev commented Jul 25, 2015

I vote for not exporting it and considering excising it from the codebase.

@heff
Copy link
Member

heff commented Jul 25, 2015

Yeah works for me.

Sent from mobile

@misteroneill
Copy link
Member Author

Sounds good. Wasn't sure about renaming EventEmitter, but I'll take care of that. Also, I'll remove roundFloat/round entirely and switch any uses to Number#toFixed.

if (typeof subClassMethods.init === 'function') {
log.warn('Constructor logic via init() is deprecated; please use constructor() instead.');
subClassMethods.constructor = subClassMethods.init;
delete subClassMethods.init;
Copy link
Member Author

Choose a reason for hiding this comment

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

I wasn't 100% sure deleteing the init was the best idea here. Had a minor concern that users inspecting the prototype chain could get thrown off, but perhaps the deprecation warning is enough.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure on this one either, but we may want to consider leaving it in case older external code points to the init directly for some reason. Probably better they get the warning than a broken function.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good enough reason for me. I'll remove this line.

@gkatsev
Copy link
Member

gkatsev commented Jul 27, 2015

LGTM

@misteroneill
Copy link
Member Author

BTW, I updated the wiki, too. Apparently you don't have to be an org member to change wiki pages... who knew!

@gkatsev
Copy link
Member

gkatsev commented Jul 27, 2015

Yep, by default wikis are open to everyone. for better or worse.

@misteroneill
Copy link
Member Author

At least the wiki is just a git repo, so it's easy enough to roll back. 😄

@@ -329,7 +328,7 @@ export function findElPosition(el) {

// Android sometimes returns slightly off decimal values, so need to round
return {
left: roundFloat(left),
Copy link
Member

Choose a reason for hiding this comment

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

I think these should these just be Math.round() now. Back when roundFloat was just round it was used for most rounding.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, I see. Instead of toFixed with no arguments, use Math.round. Makes sense.

@heff
Copy link
Member

heff commented Jul 28, 2015

LGTM!

EventTarget stills feels a little awkward to me exported directly on videojs. If someone can think of a namespace it and others like it could live under I'd be interested in that. But no need to figure that out for this PR.

@gkatsev
Copy link
Member

gkatsev commented Jul 28, 2015

We could register EventTarget as a component so it's available through getComponent, though, it isn't technically a component.

@misteroneill
Copy link
Member Author

@heff Addressed the issues you raised (except EventTarget being on the videojs namespace).

@heff
Copy link
Member

heff commented Jul 28, 2015

Great! I think it's good to pull in.

Sent from mobile

In case it's referenced by external code, we don't want to `delete` it
and potentially cause errors for consumers.
The previous code was added in the transition away from the round-float
module to using `Number#toFixed`. It was kind of a round-about and inelegant
way of achieving this - casting to string and back to number.
@dmlap dmlap closed this in 8aa61d3 Jul 30, 2015
@misteroneill misteroneill deleted the restorations branch August 3, 2015 20:48
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