mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-21 11:15:36 -05:00
Use async/await instead of promise chaining (#266)
* Use async/await instead of promise chaining * Await asynchronous operations
This commit is contained in:
@@ -61,12 +61,10 @@ export class PyButton extends BaseEvalElement {
|
||||
|
||||
// now that we appended and the element is attached, lets connect with the event handlers
|
||||
// defined for this widget
|
||||
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);
|
||||
|
||||
console.log('py-button connected');
|
||||
|
||||
Reference in New Issue
Block a user