Skip to content
Permalink
Browse files

removed unnecessary toJSON method

  • Loading branch information...
hauptpas committed May 21, 2018
1 parent f3b9e97 commit d76ae63f988e879ddbe727242061e86a26291d0c
Showing with 1 addition and 31 deletions.
  1. +1 −31 src/TaskList.js
@@ -26,23 +26,6 @@ TaskList.prototype.render = function () {
return $('<ul>').append($tasks);
};


TaskList.prototype.toJSON = function () {
var jsonString = {
id: this.id,
title: this.title,
tasks: []
};
var i;
for (i = 0; i < this.tasks.length; i += 1) {
jsonString.tasks.push({
title: this.tasks[i].title,
done: this.tasks[i].done
});
}
return JSON.stringify(jsonString);
};

/*
* persists the tasklist to the server.
*
@@ -56,24 +39,12 @@ TaskList.prototype.save = function () {
if (this.id) {
url += this.id;
}
$.post(url, this.toJSON(), function (returnedData) {
$.post(url, JSON.stringify(this), function (returnedData) {
that.id = JSON.parse(returnedData).id;
window.location.hash = that.id;
});
};

// TaskList.prototype.shuffle = function () {
// var tasksArray = this.tasks;
// var i;
// for (i = 0; i < this.tasks.length; i += 1) {
// var checked = tasksArray[i].done;

// if (checked) {
// // tasksArray[i].appendTo("#taskList ul")
// }
// }
// };

/*
* Loads the given tasklist from the server.
*/
@@ -87,7 +58,6 @@ TaskList.load = function (id, callback) {
});
taskList.title = returnedData.title;
callback(taskList);
// taskList.shuffle();

});
};

0 comments on commit d76ae63

Please sign in to comment.
You can’t perform that action at this time.