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

Added and extends function for external subclassing #2078

Closed
wants to merge 2 commits into from

Conversation

heff
Copy link
Member

@heff heff commented Apr 28, 2015

Addresses #2035

It uses the babel _inherits under the hood, with the added benefit of defining additional methods. The external API will look like the following:

 var Button = videojs.getComponent('Button');

 var MyButton = videojs.extends(Button, {
   constructor: function(player, options) {
     Button.call(this, player, options);
   },

  onClick: function() {
    // doSomething
  }
});

@@ -39,6 +38,9 @@ videojs.util = Util;
import Player from './player';
videojs.players = Player.players;

import extendsFn from './extends.js';
Copy link
Member

Choose a reason for hiding this comment

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

we should import everything at the top of the file.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated. Everything else look ok?

@gkatsev
Copy link
Member

gkatsev commented Apr 28, 2015

LGTM

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

Successfully merging this pull request may close these issues.

2 participants