Support getters and setters #19

Closed
wants to merge 4 commits into
from

Projects

None yet

2 participants

@novemberborn

Fixes support for getters and setters where supported by the engine. This only works if the getter/setter is set on the mixed in object directly.

Also cleaned up whitespace and linting errors and added a .gitignore.

Haven't added tests due to the issues in #17 and #18.

Example:

var Counter = Compose(function(){
  this._i = 0;
}, {
  get next(){
    return this._i++;
  }
});

var counter = new Counter;
counter.next; // 0
counter.next; // 1
counter.next; // 2
@kriszyp
Owner
kriszyp commented Feb 25, 2012

I had started on something like this. However, the getter/setter code needs to be in it's own module, and only loaded in server environment or if user selects it. There is no reason for this code to add size to the browser version of compose.js.

@novemberborn

Hmm, not sure how that would be achieved though. Dependency injection for the mixin method?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment