standardize watch feature

memolus at googlemail.com memolus at googlemail.com
Sun Dec 27 12:56:21 PST 2009


I would have to use *2* names per attribute "x" and "x_". That's
crazy. I would have to use an library which does make this job for me.

I can't write an model with

Object.defineProperty(
    model, 'x',
    { 'set': function (newx) {  model.x_ = x; object1.signal("x");
object2.signal("x"); object3.signal("x") },
      'get': function() { return model.x_ }, writable: true })

2009/12/27 Mike Samuel <mikesamuel at gmail.com>:
> ES5 Setters let you do this.
>
> Object.defineProperty(
>    model, 'x',
>    { 'set': function (newx) { model.x_ = x; },
>      'get': function() { return model.x_ }, writable: true })


More information about the es-discuss mailing list