mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
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:
@@ -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)});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user