Make onClose async too

a4ee73a3a7fc86bf2eea3bcea2540b290c3bb152

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +4 -4Showing whitespace changes
public/scripts/popup.js+4 -4
@@ -41,7 +41,7 @@ export const POPUP_RESULT = {
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.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 * @property {CustomPopupInput[]?} [customInputs=null] - Custom inputs to add to the popup. The display below the content and the input box, one by one.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 * @property {(popup: Popup) => Promise<boolean?>|boolean?} [onClosing=null] - Handler called before the popup closes, return `false` to cancel the close43 * @property {(popup: Popup) => Promise<boolean?>|boolean?} [onClosing=null] - Handler called before the popup closes, return `false` to cancel the close
44 * @property {(popup: Popup) => void?} [onClose=null] - Handler called after the popup closes, but before the DOM is cleaned up44 * @property {(popup: Popup) => Promise<void?>|void?} [onClose=null] - Handler called after the popup closes, but before the DOM is cleaned up
45 * @property {number?} [cropAspect=null] - Aspect ratio for the crop popup45 * @property {number?} [cropAspect=null] - Aspect ratio for the crop popup
46 * @property {string?} [cropImage=null] - Image URL to display in the crop popup46 * @property {string?} [cropImage=null] - Image URL to display in the crop popup
47 */47 */
@@ -139,7 +139,7 @@ export class Popup {
139 /** @readonly @type {CustomPopupInput[]} */ customInputs;139 /** @readonly @type {CustomPopupInput[]} */ customInputs;
140140
141 /** @type {(popup: Popup) => Promise<boolean?>|boolean?} */ onClosing;141 /** @type {(popup: Popup) => Promise<boolean?>|boolean?} */ onClosing;
142 /** @type {(popup: Popup) => void?} */ onClose;142 /** @type {(popup: Popup) => Promise<void?>|void?} */ onClose;
143143
144 /** @type {POPUP_RESULT|number} */ result;144 /** @type {POPUP_RESULT|number} */ result;
145 /** @type {any} */ value;145 /** @type {any} */ value;
@@ -547,13 +547,13 @@ export class Popup {
547 fixToastrForDialogs();547 fixToastrForDialogs();
548548
549 // After the dialog is actually completely closed, remove it from the DOM549 // After the dialog is actually completely closed, remove it from the DOM
550 runAfterAnimation(this.dlg, () => {550 runAfterAnimation(this.dlg, async () => {
551 // Call the close on the dialog551 // Call the close on the dialog
552 this.dlg.close();552 this.dlg.close();
553553
554 // Run a possible custom handler right before DOM removal554 // Run a possible custom handler right before DOM removal
555 if (this.onClose) {555 if (this.onClose) {
556 this.onClose(this);556 await this.onClose(this);
557 }557 }
558558
559 // Remove it from the dom559 // Remove it from the dom