rpora
10/6/2016 - 7:44 AM

observes()

function observes(target: any, key: string) {

  var _val = this[key]

  const getter = function () {
    return _val
  }

  const setter = function (next) {
    if(next !== _val){
      _val = next
      // notifyObservers()
    }
  }
  // Add / remove an observer ?

}


class Model {

  @observes
  public username

  constructor(username: string) {
    this.username = username
  }

}