mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-21 03:05:38 -05:00
Minor improvements (#556)
* checkpoint: added some text * checkpoint: added setting up the environment, tips for writing good issues * continuing to fill it out * added more detailed description of the process of creating a change and some other cleanup. * added a getting started section and cleaned up the grammar. This ready for the PR now * forgot to add the new section to the TOC * Minor fixes Co-authored-by: Kevin Goldsmith <kgoldsmith@anaconda.com> Co-authored-by: Matt Kramer <mkramer@anaconda.com>
This commit is contained in:
@@ -152,11 +152,8 @@ export class BaseEvalElement extends HTMLElement {
|
||||
this.outputElement.style.display = 'block';
|
||||
}
|
||||
|
||||
if (is_async) {
|
||||
await pyodide.runPythonAsync(`output_manager.revert()`);
|
||||
} else {
|
||||
await pyodide.runPython(`output_manager.revert()`);
|
||||
}
|
||||
is_async ? await pyodide.runPythonAsync(`output_manager.revert()`)
|
||||
: await pyodide.runPython(`output_manager.revert()`);
|
||||
|
||||
// check if this REPL contains errors, delete them and remove error classes
|
||||
const errorElements = document.querySelectorAll(`div[id^='${this.errorElement.id}'][error]`);
|
||||
@@ -189,11 +186,10 @@ export class BaseEvalElement extends HTMLElement {
|
||||
} // end evaluate
|
||||
|
||||
async eval(source: string): Promise<void> {
|
||||
let output;
|
||||
const pyodide = runtime;
|
||||
|
||||
try {
|
||||
output = await pyodide.runPythonAsync(source);
|
||||
const output = await pyodide.runPythonAsync(source);
|
||||
if (output !== undefined) {
|
||||
console.log(output);
|
||||
}
|
||||
@@ -268,10 +264,9 @@ function createWidget(name: string, code: string, klass: string) {
|
||||
}
|
||||
|
||||
async eval(source: string): Promise<void> {
|
||||
let output;
|
||||
const pyodide = runtime;
|
||||
try {
|
||||
output = await pyodide.runPythonAsync(source);
|
||||
const output = await pyodide.runPythonAsync(source);
|
||||
this.proxyClass = pyodide.globals.get(this.klass);
|
||||
if (output !== undefined) {
|
||||
console.log(output);
|
||||
@@ -281,7 +276,6 @@ function createWidget(name: string, code: string, klass: string) {
|
||||
}
|
||||
}
|
||||
}
|
||||
const xPyWidget = customElements.define(name, CustomWidget);
|
||||
}
|
||||
|
||||
export class PyWidget extends HTMLElement {
|
||||
@@ -361,16 +355,14 @@ export class PyWidget extends HTMLElement {
|
||||
}
|
||||
|
||||
async getSourceFromFile(s: string): Promise<string> {
|
||||
const pyodide = runtime;
|
||||
const response = await fetch(s);
|
||||
return await response.text();
|
||||
}
|
||||
|
||||
async eval(source: string): Promise<void> {
|
||||
let output;
|
||||
const pyodide = runtime;
|
||||
try {
|
||||
output = await pyodide.runPythonAsync(source);
|
||||
const output = await pyodide.runPythonAsync(source);
|
||||
if (output !== undefined) {
|
||||
console.log(output);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user