new heritage module should provide a way to define writable property to the prototype

RESOLVED INCOMPLETE

Status

Add-on SDK
General
P3
normal
RESOLVED INCOMPLETE
6 years ago
8 months ago

People

(Reporter: zer0, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
In classical prototypal approach we can have:

  function MyClass() {
    this.data = {}
  }

  MyClass.prototype = {
    data: null
  }

And in old `Base.extend` we had:

  MyClass = Class(Base.extend({
    data: null,

    initialize: function() {
      this.merge({
        data: {}
      })
    } 
  }))

But there is no way at the moment to do the same in `heritage`, that's because the properties in the prototype are not writable, we can only add a property dynamically:

  MyClass = Class({
    initialize: function() {
      this.data = {}
    } 
  })

That's especially useful to list properties, set the default values (if they're primitive), and document them properly in the code.

Updated

6 years ago
Priority: -- → P3
https://bugzilla.mozilla.org/show_bug.cgi?id=1399562
Status: NEW → RESOLVED
Last Resolved: 8 months ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.