Поправки потенциальных багов, мелкий рефакторинг

This commit is contained in:
Book Pauk
2019-10-27 19:36:50 +07:00
parent 697093d1c9
commit 0dc650305a
2 changed files with 8 additions and 12 deletions

View File

@@ -477,7 +477,7 @@ class TextPage extends Vue {
generateWaitingFunc(waitingHandlerName, stopPropertyName) {
const func = (timeout) => {
return new Promise(async(resolve) => {
return new Promise((resolve, reject) => { (async() => {
this[waitingHandlerName] = resolve;
let wait = (timeout + 201)/100;
while (wait > 0 && !this[stopPropertyName]) {
@@ -485,7 +485,7 @@ class TextPage extends Vue {
await sleep(100);
}
resolve();
});
})().catch(reject); });
};
return func;
}