8000 add timer to register generic widgets · kevin808/pyscript@019b7d1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 019b7d1

Browse files
committed
add timer to register generic widgets
1 parent ac64b2a commit 019b7d1

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

pyscriptjs/src/components/base.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,18 @@ export class BaseEvalElement extends HTMLElement {
192192
}
193193

194194
connectedCallback() {
195-
console.log(this.name, 'OOOOOOO connected!!!!')
196-
this.eval(this.code).then(() => {
197-
this.proxy = this.proxyClass(this);
198-
console.log('proxy', this.proxy);
199-
this.proxy.connect();
200-
this.registerWidget();
201-
});
202-
console.log(this.name, 'DOOOOONE connected!!!!')
195+
// TODO: we are calling with a 2secs delay to allow pyodide to load
196+
// ideally we can just wait for it to load and then run. To do
197+
// so we need to replace using the promise and actually using
198+
// the interpreter after it loads completely
199+
setTimeout(() => {
200+
this.eval(this.code).then(() => {
201+
this.proxy = this.proxyClass(this);
202+
console.log('proxy', this.proxy);
203+
this.proxy.connect();
204+
this.registerWidget();
205+
});
206+
}, 2000);
203207
}
204208

205209
async registerWidget(){

0 commit comments

Comments
 (0)
0