Skip to content

X:style

haehn edited this page May 7, 2012 · 10 revisions

XTK coding style draft

  • if possible, always inherit from X.base - this enables the event system
  • each class has a className attribute (for duck typing and down casting)
  /**
   * @inheritDoc
   * @const
   */
  this['className'] = 'renderer';

Class variables / Properties

  • Only public or protected properties
  • Public properties replace simple getters like this (which avoids optimization by the compiler):
 this['container'] = _container;
  • Protected properties (will be renamed during optimization)
 this.objects = new X.array();

Local variables

  • always start with a underscore (_)

Clone this wiki locally