onUpdate und onDelete als Funktionen für ShoppingCategory hinzugefügt
This commit is contained in:
1 parent
9684f8f64b
commit
433c1bac3a
2 files changed
+3
-2
No files matched your search
@@ -2,12 +2,13 @@ import { addNewItem } from "./main";
|
||||
|
||||
export class ShoppingCategory {
|
||||
|
||||
constructor(categoryName, onDelete) {
|
||||
constructor(categoryName, onDelete, onUpdate) {
|
||||
this.categoryName = categoryName;
|
||||
this.itemsInCategory = [];
|
||||
this.remove = false;
|
||||
this.isEditing = false;
|
||||
this.onDelete = onDelete;
|
||||
this.onUpdate = onUpdate;
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ const itemListElement = document.querySelector(".displayedList");
|
||||
let listElements = []; // Liste der erstellten Items und Kategorien
|
||||
|
||||
function addNewCategory(categoryName) {
|
||||
listElements.push(new ShoppingCategory(categoryName, renderItemList));
|
||||
listElements.push(new ShoppingCategory(categoryName, renderAddItemPrompt, renderItemList));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user