Function declaration naming conventions

I’m curious about these two ways of declaring functions in ember:

export default Ember.Component.extend({
    didInsertElement() {
    didInsertElement: function() {

Both seem to work just fine. I’ve seen both in different areas of the documentation (most examples use the second form, but ‘services’ for example uses the first form. Is there a difference? Should I pick one and go with it? Any implications I should know about?

Thanks for you help, Shaun

didInsertElement() - is just an ES6 functionality. Almost all the browsers started supporting this.

So, going forward, usage of didInsertElement: function() must be prevented

There is another and more suggested form -

computeName: Ember.on (‘didInsertElement’, fucntion () { … })

This makes your logic more readable.

Thanks for pointing me in the right direction. For anyone else who may be curious, the formal name for this new syntax seems to be “method notation” or “ES6 shorthand method names”. Here’s some more information: