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

We should hide private methods #514

Open
birtles opened this issue Dec 11, 2013 · 6 comments
Open

We should hide private methods #514

birtles opened this issue Dec 11, 2013 · 6 comments

Comments

@birtles
Copy link
Contributor

birtles commented Dec 11, 2013

Some users are clearly calling these methods that start with underscores. That's less than ideal since their code will break when native implementations are available. It also means we're not getting feedback about the API as-specced.

@dstoc
Copy link
Contributor

dstoc commented Dec 11, 2013

That's unfortunate. The underscore should be a pretty good hint that these methods are not intended to be called.

A couple of options:

  • Pass tokens as we do now to prevent certain constructors from being called.
  • Pull the methods off the prototypes, and .call them?
  • Promote usage of a minified build where symbols other than what we choose to export are obfuscated.

@birtles
Copy link
Contributor Author

birtles commented Dec 12, 2013

Yeah, we could use private functions but then they don't end up on the prototype chain and I guess we need that (e.g. this sort of approach: http://stackoverflow.com/questions/55611/javascript-private-methods). Maybe it's not worth the effort of rewriting things to work around this.

@mithro
Copy link
Contributor

mithro commented Dec 19, 2013

Do you have examples of people calling them? Maybe they have a use case we haven't covered?

@birtles
Copy link
Contributor Author

birtles commented Dec 20, 2013

There is this sort if thing:
http://lists.w3.org/Archives/Public/public-fx/2013OctDec/0096.html

It seems to be mostly just not understanding that '_' means 'don't use'. 
So in this message the author is using '_player' instead of 'player'.

@mithro
Copy link
Contributor

mithro commented Dec 20, 2013

I think that user knows they are using the private API, they say

I would be forced to use private API to clean up animations not contained in a group:
anim.onend = function() { 
    if (anim.parent) anim.remove();
    else anim._player._deregisterFromTimeline();
}

@birtles
Copy link
Contributor Author

birtles commented Dec 20, 2013

That's only because I pointed it out in a separate thread. (And still he keeps on using it.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants