[#181] move setVisibility to App.mjs since it's pretty generic and could be reused. Update TODO

This commit is contained in:
Robin Scholtes 2023-04-19 23:31:06 +12:00
parent f6b23ecca5
commit 12116e53b1
3 changed files with 29 additions and 34 deletions

View file

@ -860,6 +860,25 @@ class App {
this.loadURIParams();
}
/**
* Set element visibility
*
* @param {HTMLElement} elm
* @param {boolean} isVisible
*
*/
setVisibility( elm, isVisible ){
if ( isVisible ) {
if ( elm.classList.contains("hidden")) {
elm.classList.remove("hidden");
}
} else if ( isVisible === false ) {
if ( !elm.classList.contains("hidden")){
elm.classList.add("hidden");
}
}
}
}
export default App;