isPromiseLike and resolve partial of Grid.
This commit is contained in:
1 parent
ec086e29aa
commit
a78ef2df39
7 files changed
+1359
-619
No files matched your search
+9
-6
@@ -1,7 +1,7 @@
|
||||
import "./css/popup.scss";
|
||||
import { r as lang } from "../utility/lgres";
|
||||
import { nullOrEmpty } from "../utility/strings";
|
||||
import { global } from "../utility";
|
||||
import { global, isPromiseLike } from "../utility";
|
||||
import { appendResizer, makeMovable } from "./movable";
|
||||
import { createElement, mergeOptions } from "../functions";
|
||||
import { createIcon, changeIcon } from "./icon";
|
||||
@@ -352,17 +352,20 @@ export class Popup {
|
||||
} else {
|
||||
this._var.__resolved = false;
|
||||
}
|
||||
} else if (typeof result?.then === 'function') {
|
||||
result.then(r => {
|
||||
} else if (isPromiseLike(result)) {
|
||||
const tmp = result.then(r => {
|
||||
if (r !== false) {
|
||||
this.close(r);
|
||||
} else {
|
||||
this._var.__resolved = false;
|
||||
}
|
||||
}).catch(reason => {
|
||||
this._var.__resolved = false;
|
||||
console.warn(reason);
|
||||
});
|
||||
if ('catch' in tmp && typeof tmp.catch === 'function') {
|
||||
tmp.catch(/** @param {any} reason */ reason => {
|
||||
this._var.__resolved = false;
|
||||
console.warn(reason);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.close();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user