Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4870

Why does super need to refer to the parent classes actions, when called from within an action

$
0
0

The ember-native-class-codemod adds this comment when refactoring calls to super in an action that overrides its namesake in a parent class.

    // TODO: This call to super is within an action, and has to refer to the parent
    // class's actions to be safe. This should be refactored to call a normal method
    // on the parent class. If the parent class has not been converted to native
    // classes, it may need to be refactored as well. See
    // https://github.com/scalvert/ember-native-class-codemod/blob/master/README.md
    // for more details.
    super.actions.submitSuccess.call(this, ...arguments);

Out of interest, why would it be unsafe to do so without referring to the parent classes actions, as below?

super.submitSuccess(...arguments)

Both super.actions.submitSuccess and super.submitSuccess log the same function.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 4870

Trending Articles