Add update method, remove getters..

This makes the osmNote work a bit more like other osm objects in iD.

- When working with the osm objects, we'll treat them as immutable.
  So all modifications will be through the update method:

  e.g. can do this in a repl, like chrome devtools console:
  >  n = iD.osmNote()
  osmNote { id: -1 }
  > n = n.update({ foo: 'bar' });
  osmNote { foo: "bar", id: -1, v: 1 }

- none of the other osm objects have getters, and in JavaScript all the
  properties are public anyway
This commit is contained in:
Bryan Housel
2018-06-29 22:47:14 -04:00
parent fd1d2f006b
commit ede561080d

View File

@@ -49,15 +49,7 @@ _extend(osmNote.prototype, {
return new geoExtent(this.loc);
},
getID: function() {
return this.id;
},
getType: function() {
return this.type;
},
getComments: function() {
return this.comments;
update: function(attrs) {
return osmNote(this, attrs, {v: 1 + (this.v || 0)});
}
});