Make onClose async too
| @@ -41,7 +41,7 @@ export const POPUP_RESULT = { | ||
| 41 | 41 | * @property {CustomPopupButton[]|string[]?} [customButtons=null] - Custom buttons to add to the popup. If only strings are provided, the buttons will be added with default options, and their result will be in order from `2` onward. |
| 42 | 42 | * @property {CustomPopupInput[]?} [customInputs=null] - Custom inputs to add to the popup. The display below the content and the input box, one by one. |
| 43 | 43 | * @property {(popup: Popup) => Promise<boolean?>|boolean?} [onClosing=null] - Handler called before the popup closes, return `false` to cancel the close |
| 44 | 44 | * @property {(popup: Popup) => Promise<void?>|void?} [onClose=null] - Handler called after the popup closes, but before the DOM is cleaned up |
| 45 | 45 | * @property {number?} [cropAspect=null] - Aspect ratio for the crop popup |
| 46 | 46 | * @property {string?} [cropImage=null] - Image URL to display in the crop popup |
| 47 | 47 | */ |
| @@ -139,7 +139,7 @@ export class Popup { | ||
| 139 | 139 | /** @readonly @type {CustomPopupInput[]} */ customInputs; |
| 140 | 140 | |
| 141 | 141 | /** @type {(popup: Popup) => Promise<boolean?>|boolean?} */ onClosing; |
| 142 | 142 | /** @type {(popup: Popup) => Promise<void?>|void?} */ onClose; |
| 143 | 143 | |
| 144 | 144 | /** @type {POPUP_RESULT|number} */ result; |
| 145 | 145 | /** @type {any} */ value; |
| @@ -547,13 +547,13 @@ export class Popup { | ||
| 547 | 547 | fixToastrForDialogs(); |
| 548 | 548 | |
| 549 | 549 | // After the dialog is actually completely closed, remove it from the DOM |
| 550 | 550 | runAfterAnimation(this.dlg, async () => { |
| 551 | 551 | // Call the close on the dialog |
| 552 | 552 | this.dlg.close(); |
| 553 | 553 | |
| 554 | 554 | // Run a possible custom handler right before DOM removal |
| 555 | 555 | if (this.onClose) { |
| 556 | 556 | await this.onClose(this); |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | // Remove it from the dom |