在ES6中调用重写方法

时间:2015-01-22 16:45:07

标签: javascript ecmascript-6 ember-simple-auth

我有以下代码:

import Authenticator from 'simple-auth-torii/authenticators/torii';

export default Authenticator.extend({
  restore: function(data) {

  },
  authenticate: function(provider, options) {

  },
  invalidate: function(data) {

  }
});

如何从authenticate方法内部调用基类authenticate方法?

2 个答案:

答案 0 :(得分:0)

在常见的ES5情况下,不使用Ember.Object.extend方法和{6}类继承,您必须使用标准callapply方法来实现它。因此,要调用父类的this._super方法,必须将其添加到子方法中:

authenticate

答案 1 :(得分:0)

这实际上是一个Ember.js问题,并不是特定于ES6。 Jost call,例如

this._super(provider, options)