Skip to content

Instantly share code, notes, and snippets.

@pzaich
Created July 17, 2012 01:56
Show Gist options
  • Select an option

  • Save pzaich/3126480 to your computer and use it in GitHub Desktop.

Select an option

Save pzaich/3126480 to your computer and use it in GitHub Desktop.
reinitialize objects from keys
this.retrieve = function() {
var rawList = $.totalStorage("savedlist");
// console.log(rawList);
return this.reloadList(rawList);
}
this.reloadList = function(rawObject) {
var array_of_tasks = []
for (var i = 0; i < rawObject.entries.length; i++){
var description = rawObject.entries[i].task_description
var date = rawObject.entries[i].date
var completion = rawObject.entries[i].completion
var new_entry = new Task(description, date, i, completion);
if (completion){
new_entry.complete();
}
array_of_tasks.push(new_entry);
}
return array_of_tasks
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment