21 lines
685 B
TypeScript
21 lines
685 B
TypeScript
|
// 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> {
|
||
|
/** @inheritdoc */
|
||
|
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;
|
||
|
}
|