Changes between Version 21 and Version 22 of WebInspectorCodingStyleGuide


Ignore:
Timestamp:
Dec 12, 2016 11:02:01 AM (7 years ago)
Author:
Joseph Pecoraro
Comment:

Added style notes for trivial getters.

Legend:

Unmodified
Added
Removed
Modified
  • WebInspectorCodingStyleGuide

    v21 v22  
    1717* Use arrow functions when possible, unless it makes code less readable. See below for examples.
    1818* For default parameters, add a space around the default assignment: `function foo(isGood = false)`
     19* Trivial public getters can be made a single line and moved to the top of the list of getters in a class.
    1920
    2021== Naming things
     
    163164WebInspector.NewObjectType = class NewObjectType extends WebInspector.Object
    164165{
    165     constructor(param)
     166    constructor(type, param)
    166167    {
    167168       super();
    168169       console.assert(param instanceof WebInspector.ExpectedType);
     170       this._type = type;
    169171       this._propertyName = param;
    170172    }
     
    179181
    180182    // Public
     183
     184    get type() { return this._type; }
    181185
    182186    get propertyName()