diff options
| author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2023-11-27 12:48:14 -0500 | 
|---|---|---|
| committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2023-11-27 12:48:14 -0500 | 
| commit | 4da4827bcbcdd1ef163f635d9b29416ff272b0bb (patch) | |
| tree | a8a0f1a8befdb78a554e1be91f2c6059ca3ad5f9 /ext/js/pages/settings/modal-controller.js | |
| parent | fd6bba8a2a869eaf2b2c1fa49001f933fce3c618 (diff) | |
Add JSDoc type annotations to project (rebased)
Diffstat (limited to 'ext/js/pages/settings/modal-controller.js')
| -rw-r--r-- | ext/js/pages/settings/modal-controller.js | 12 | 
1 files changed, 11 insertions, 1 deletions
| diff --git a/ext/js/pages/settings/modal-controller.js b/ext/js/pages/settings/modal-controller.js index 517a19b3..852bdcc5 100644 --- a/ext/js/pages/settings/modal-controller.js +++ b/ext/js/pages/settings/modal-controller.js @@ -20,13 +20,16 @@ import {Modal} from './modal.js';  export class ModalController {      constructor() { +        /** @type {Modal[]} */          this._modals = []; +        /** @type {Map<string|Element, Modal>} */          this._modalMap = new Map();      } +    /** */      prepare() {          const idSuffix = '-modal'; -        for (const node of document.querySelectorAll('.modal')) { +        for (const node of /** @type {NodeListOf<HTMLElement>} */ (document.querySelectorAll('.modal'))) {              let {id} = node;              if (typeof id !== 'string') { continue; } @@ -42,11 +45,18 @@ export class ModalController {          }      } +    /** +     * @param {string|Element} nameOrNode +     * @returns {?Modal} +     */      getModal(nameOrNode) {          const modal = this._modalMap.get(nameOrNode);          return (typeof modal !== 'undefined' ? modal : null);      } +    /** +     * @returns {?Modal} +     */      getTopVisibleModal() {          for (let i = this._modals.length - 1; i >= 0; --i) {              const modal = this._modals[i]; |