PDA

View Full Version : Config setters should document the return value



LesJ
1 May 2017, 10:02 AM
Setters should be marked as chainable.

I don't see that config setters document the return value. I think the return value should be documented.

Take, for instance, the component.setData (https://docs.sencha.com/extjs/6.2.1/classic/Ext.Component.html#method-setData) setter. This setter documents on the parameter (data) to be set, but not the return value, which is the component itself.

Ext.define('MyClass', {
config: {
value: undefined
},
constructor: function (config) {
this.initConfig(config);
}
});


var obj = new MyClass();


obj.setValue('zzz').$className // MyClass