Add lastChange in GroupList export return

This commit is contained in:
Benjamin Renard 2014-01-27 23:50:28 +01:00
parent 52f4d37b88
commit a2e33ea274

View file

@ -28,9 +28,12 @@ function GroupList() {
} }
this.export=function() { this.export=function() {
return this.each(function(idx,group) { return {
'lastChange': this.lastChange,
'groups': this.each(function(idx,group) {
return group.export(); return group.export();
}); })
};
} }
this.import=function(groups) { this.import=function(groups) {
@ -40,18 +43,16 @@ function GroupList() {
delete ret[el]; delete ret[el];
} }
} }
for (el in groups) { this.lastChange=groups.lastChange;
this[el]=new Group(el,false,groups[el]); for (el in groups.groups) {
this[el]=new Group(el,false,groups.groups[el]);
} }
return true; return true;
} }
this.save=function() { this.save=function() {
localStorage.groups=JSON.stringify({ localStorage.groups=JSON.stringify(this.export());
'lastChange': new Date().getTime(),
'groups': this.export()
});
} }
this.each=function(fct) { this.each=function(fct) {