Created
July 17, 2012 01:56
-
-
Save pzaich/3126480 to your computer and use it in GitHub Desktop.
reinitialize objects from keys
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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