Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4828

Best/conventional way to document properties on ECMA classes?

$
0
0

@samselikoff wrote:

Let’s say I have a class:

/**
  The Mirage server.

  @class Server
  @public
*/
export default class Server {

  constructor(options = {}) {
    this.namespace = options.namespace '';
  }
  
}

What would be the best way to use JSDoc to document the namespace property?

One thought was to define a new getter:

export default class Server {

  constructor(options = {}) {
    this._namespace = options.namespace '';
  }

  /** 
    @property namespace
    @type String
    @public
  */
  get namespace() {
    return this._namespace;
  } 
}

Are there any other project doing this? Any established best practices or conventions?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles