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

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

interface DialogWithListenersOptions extends DialogOptions {
    activateAdditionalListeners?: ((html: JQuery, app: DialogWithListeners) => void) | undefined;
}