1
0
mirror of https://github.com/pyscript/pyscript.git synced 2022-05-01 19:47:48 +03:00

add timer to register generic widgets

This commit is contained in:
Fabio Pliger
2022-04-20 18:16:26 -05:00
parent ac64b2aaa3
commit 019b7d145a

View File

@@ -192,14 +192,18 @@ export class BaseEvalElement extends HTMLElement {
}
connectedCallback() {
console.log(this.name, 'OOOOOOO connected!!!!')
// TODO: we are calling with a 2secs delay to allow pyodide to load
// ideally we can just wait for it to load and then run. To do
// so we need to replace using the promise and actually using
// the interpreter after it loads completely
setTimeout(() => {
this.eval(this.code).then(() => {
this.proxy = this.proxyClass(this);
console.log('proxy', this.proxy);
this.proxy.connect();
this.registerWidget();
});
console.log(this.name, 'DOOOOONE connected!!!!')
}, 2000);
}
async registerWidget(){