Use async/await instead of promise chaining (#266)

* Use async/await instead of promise chaining

* Await asynchronous operations
This commit is contained in:
woxtu
2022-05-10 02:32:01 +09:00
committed by GitHub
parent d645722421
commit a993d61885
4 changed files with 26 additions and 34 deletions

View File

@@ -41,12 +41,10 @@ export class PyInputBox extends BaseEvalElement {
// TODO: For now we delay execution to allow pyodide to load but in the future this
// should really wait for it to load..
setTimeout(() => {
this.eval(this.code).then(() => {
this.eval(registrationCode).then(() => {
console.log('registered handlers');
});
});
setTimeout(async () => {
await this.eval(this.code);
await this.eval(registrationCode);
console.log('registered handlers');
}, 4000);
}
}