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
| $.totalStorage("savedlist", myList); |
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
| return $.totalStorage("savedlist"); |
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
| var listSaver = new SaveToDb(); | |
| var myList = new TaskList(); |
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
| if (listSaver.not_empty()){ | |
| myList.entries = listSaver.retrieve(); | |
| console.log(myList.entries); | |
| } | |
| this.not_empty = function() { | |
| return $.totalStorage("savedlist"); | |
| } |
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 |
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
| //The standard localStorage function for saving a value | |
| localStorage.setItem(<key>, <value>); | |
| //Using the nice jQuery plugin | |
| $.totalStorage(<key>, <value>); |
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
| var objectLiteral = { | |
| some_value: 0, | |
| some_function: function (arguments) { | |
| //function and return | |
| } | |
| }; |
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
| var newObject = objectMaker(); |
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
| var objectMaker = function(){ | |
| var instance = {}; | |
| instance.array = []; | |
| instance.value = 0; | |
| instance.someFunctionOfObject = function(arguments) { | |
| //function returned here | |
| } | |
| return instance; | |
| } |
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
| var objectConstructor = function(value){ | |
| this.value = value; | |
| this.arr = []; | |
| this.someFunctionBoundtoObject = function () { | |
| //function bound to object here | |
| } | |
| //No return needed | |
| }; |