summaryrefslogtreecommitdiff
path: root/ext/js/pages/settings/status-footer.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2023-11-27 12:48:14 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2023-11-27 12:48:14 -0500
commit4da4827bcbcdd1ef163f635d9b29416ff272b0bb (patch)
treea8a0f1a8befdb78a554e1be91f2c6059ca3ad5f9 /ext/js/pages/settings/status-footer.js
parentfd6bba8a2a869eaf2b2c1fa49001f933fce3c618 (diff)
Add JSDoc type annotations to project (rebased)
Diffstat (limited to 'ext/js/pages/settings/status-footer.js')
-rw-r--r--ext/js/pages/settings/status-footer.js34
1 files changed, 28 insertions, 6 deletions
diff --git a/ext/js/pages/settings/status-footer.js b/ext/js/pages/settings/status-footer.js
index 6c64794f..a8f1a8c4 100644
--- a/ext/js/pages/settings/status-footer.js
+++ b/ext/js/pages/settings/status-footer.js
@@ -19,34 +19,52 @@
import {PanelElement} from '../../dom/panel-element.js';
export class StatusFooter extends PanelElement {
+ /**
+ * @param {HTMLElement} node
+ */
constructor(node) {
super({
node,
closingAnimationDuration: 375 // Milliseconds; includes buffer
});
- this._body = node.querySelector('.status-footer');
+ /** @type {HTMLElement} */
+ this._body = /** @type {HTMLElement} */ (node.querySelector('.status-footer'));
}
+ /** */
prepare() {
- this.on('closeCompleted', this._onCloseCompleted.bind(this), false);
- this._body.querySelector('.status-footer-header-close').addEventListener('click', this._onCloseClick.bind(this), false);
+ const closeButton = /** @type {HTMLElement} */ (this._body.querySelector('.status-footer-header-close'));
+ this.on('closeCompleted', this._onCloseCompleted.bind(this));
+ closeButton.addEventListener('click', this._onCloseClick.bind(this), false);
}
+ /**
+ * @param {string} selector
+ * @returns {?HTMLElement}
+ */
getTaskContainer(selector) {
return this._body.querySelector(selector);
}
+ /**
+ * @param {string} selector
+ * @returns {boolean}
+ */
isTaskActive(selector) {
const target = this.getTaskContainer(selector);
- return (target !== null && target.dataset.active);
+ return (target !== null && !!target.dataset.active);
}
+ /**
+ * @param {string} selector
+ * @param {boolean} active
+ */
setTaskActive(selector, active) {
const target = this.getTaskContainer(selector);
if (target === null) { return; }
const activeElements = new Set();
- for (const element of this._body.querySelectorAll('.status-footer-item')) {
+ for (const element of /** @type {NodeListOf<HTMLElement>} */ (this._body.querySelectorAll('.status-footer-item'))) {
if (element.dataset.active) {
activeElements.add(element);
}
@@ -68,13 +86,17 @@ export class StatusFooter extends PanelElement {
// Private
+ /**
+ * @param {MouseEvent} e
+ */
_onCloseClick(e) {
e.preventDefault();
this.setVisible(false);
}
+ /** */
_onCloseCompleted() {
- for (const element of this._body.querySelectorAll('.status-footer-item')) {
+ for (const element of /** @type {NodeListOf<HTMLElement>} */ (this._body.querySelectorAll('.status-footer-item'))) {
if (!element.dataset.active) {
element.hidden = true;
}