peerlibrary / meteor-blaze-components

Reusable components for Blaze
http://components.meteorapp.com/
BSD 3-Clause "New" or "Revised" License
354 stars 26 forks source link

bit confused on 'super' #85

Closed newswim closed 9 years ago

newswim commented 9 years ago

do I need to add super.events().concat to my events() array? I'm trying to get up to speed on the newest best practices, great library!

mitar commented 9 years ago

That is a good pattern to always have. Just so that you never by accident extend the class and override events from the parent class. So you should be always adding that, even if you are extending a base class and you do not need event handlers from there (currently there are none, but maybe in the future we will add some there). This also makes it future proof.

In some examples I do not do that because in vanilla JavaScript calling super is a bit ugly. But with ES2015 and CoffeeScript is super easy.

newswim commented 9 years ago

Thanks, Mitar! This is amazing work.