mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-20 10:47:35 -05:00
add better support for new widgets
This commit is contained in:
@@ -149,7 +149,23 @@ export class BaseEvalElement extends HTMLElement {
|
||||
this.errorElement.hidden = false;
|
||||
this.errorElement.style.display = 'block';
|
||||
}
|
||||
}
|
||||
} // end evaluate
|
||||
|
||||
async eval(source: string): Promise<void> {
|
||||
let output;
|
||||
let pyodide = await pyodideReadyPromise;
|
||||
|
||||
try{
|
||||
output = await pyodide.runPythonAsync(source);
|
||||
|
||||
if (output !== undefined){
|
||||
console.log(output);
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
} // end eval
|
||||
}
|
||||
|
||||
function createWidget(name: string, code: string, klass: string){
|
||||
|
||||
Reference in New Issue
Block a user