The code looks okay. The only thing to be aware of is that when event listeners are added to DOM elements, there could be memory leaks if those elements would happen to get removed from the DOM (including re-creation). An alternative approach would be to add an event listener to a parent/root element and delegate function calls based on the type of element that was clicked.
The indentation in adminMode.init()
is somewhat inconsistent towards the end.
Semi-colons are added to terminate most all lines, except for the lines that declare objects (e.g. octopus
, viewList
, etc. but not the first one i.e. model
).
These lines in viewDetailsList.init()
could be simplified:
this.catImg.addEventListener("click", function(){
octopus.catClicks();
})
could be simplified to just this:
this.catImg.addEventListener("click", octopus.catClicks)
The code looks okay. The only thing to be aware of is that when event listeners are added to DOM elements, there could be memory leaks if those elements would happen to get removed from the DOM (including re-creation). An alternative approach would be to add an event listener to a parent/root element and delegate function calls based on the type of element that was clicked.
The indentation in adminMode.init()
is somewhat inconsistent towards the end.
These lines in viewDetailsList.init()
:
this.catImg.addEventListener("click", function(){
octopus.catClicks();
})
could be simplified to:
this.catImg.addEventListener("click", octopus.catClicks)
The code looks okay. The only thing to be aware of is that when event listeners are added to DOM elements, there could be memory leaks if those elements would happen to get removed from the DOM (including re-creation). An alternative approach would be to add an event listener to a parent/root element and delegate function calls based on the type of element that was clicked.
The indentation in adminMode.init()
is somewhat inconsistent towards the end.
Semi-colons are added to terminate most all lines, except for the lines that declare objects (e.g. octopus
, viewList
, etc. but not the first one i.e. model
).
These lines in viewDetailsList.init()
could be simplified:
this.catImg.addEventListener("click", function(){
octopus.catClicks();
})
to just this:
this.catImg.addEventListener("click", octopus.catClicks)
The code looks okay. The only thing to be aware of is that when event listeners are added to DOM elements, there could be memory leaks if those elements would happen to get removed from the DOM (including re-creation). An other optionalternative approach would be to add an event listener to a parent/root element and delegate function calls based on the type of element that was clicked.
The indentation in adminMode.init()
is somewhat inconsistent towards the end.
These lines in viewDetailsList.init()
:
this.catImg.addEventListener("click", function(){
octopus.catClicks();
})
could be simplified to:
this.catImg.addEventListener("click", octopus.catClicks)
The code looks okay. The only thing to be aware of is that when event listeners are added to DOM elements, there could be memory leaks if those elements would happen to get removed from the DOM (including re-creation). An other option would be to add an event listener to a parent/root element and delegate function calls based on the type of element that was clicked.
The indentation in adminMode.init()
is somewhat inconsistent towards the end.
These lines in viewDetailsList.init()
:
this.catImg.addEventListener("click", function(){
octopus.catClicks();
})
could be simplified to:
this.catImg.addEventListener("click", octopus.catClicks)
The code looks okay. The only thing to be aware of is that when event listeners are added to DOM elements, there could be memory leaks if those elements would happen to get removed from the DOM (including re-creation). An alternative approach would be to add an event listener to a parent/root element and delegate function calls based on the type of element that was clicked.
The indentation in adminMode.init()
is somewhat inconsistent towards the end.
These lines in viewDetailsList.init()
:
this.catImg.addEventListener("click", function(){
octopus.catClicks();
})
could be simplified to:
this.catImg.addEventListener("click", octopus.catClicks)
The code looks okay. The only thing to be aware of is that when event listeners are added to DOM elements, there could be memory leaks if those elements would happen to get removed from the DOM (including re-creation). An other option would be to add an event listener to a parent/root element and delegate function calls based on the type of element that was clicked.
The indentation in adminMode.init()
is somewhat inconsistent towards the end.
These lines in viewDetailsList.init()
:
this.catImg.addEventListener("click", function(){
octopus.catClicks();
})
could be simplified to:
this.catImg.addEventListener("click", octopus.catClicks)