Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

How to overwrite interface methods

$
0
0
Not sure whether this question has been asked before, but I couldn't find it. Given this situation:

Code:

isc.defineInterface('MyInterface').addInterfaceProperties({
  myMethod: function () {
    doSomething();
  }
});

isc.defineClass('MyClass', isc.VLayout, isc.MyInterface).addProperties({
  myMethod: function () {
    this.Super('myMethod', arguments);
});

When MyClass.myMethod() is invoked, it doesn't call doSomething(). That's why I changed MyClass to:

Code:

isc.defineClass('MyClass', isc.VLayout, isc.MyInterface).addProperties({
  myMethod: function () {
    isc.MyInterface.getPrototype().myMethod.apply(this, arguments)
});

Is this the way to do it, or should working with interfaces and overwriting a method in it, be done differently?

Viewing all articles
Browse latest Browse all 4756

Trending Articles