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