// SPDX-FileCopyrightText: 2022 Johannes Loher
//
// SPDX-License-Identifier: MIT

/**
 * @typedef {DialogOptions} DialogWithListenersOptions
 * @property {(html: JQuery, app: DialogWithListeners) => void} [activateAdditionalListeners]   An optional function to attach additional listeners to the dialog
 */

/**
 * A simple extension to the {@link Dialog} class that allows attaching additional listeners.
 */
export class DialogWithListeners extends Dialog {
  /** @override */
  activateListeners(html) {
    super.activateListeners(html);
    if (this.options.activateAdditionalListeners !== undefined) {
      this.options.activateAdditionalListeners(html, this);
    }
  }
}
