javascript - ExtJS 6: Should I use the config object? -


i'm building application extjs 6. i've read guides, tutorials , best practice tips. dont understand yet is, why should use config object?

with config:

ext.define('myproject.foo.bar', {     extends: 'ext.window.window',      ...      config: {         title: 'my title'     } }); 

without config:

ext.define('myproject.foo.bar', {     extends: 'ext.window.window',      ...      title: 'my title' }); 

both working expected. can tell me difference , possible benefits?

it's described in class system guide:

  • configurations encapsulated other class members
  • getter , setter methods every config property automatically generated class prototype during class creation if methods not defined.
  • the auto-generated setter method calls apply method (if defined on class) internally before setting value. may override apply method config property if need run custom logic before setting value. if apply method not return value, setter not set value. update method (if defined) called when different value set. both apply , update methods passed new value , old value params.

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -