mirror of
https://github.com/pyscript/pyscript.git
synced 2026-03-08 22:01:04 -04:00
Add type annotations (#562)
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { loadedEnvironments, mode, pyodideLoaded } from '../stores';
|
||||
import { loadedEnvironments, mode, pyodideLoaded, type Environment } from '../stores';
|
||||
import { guidGenerator, addClasses, removeClasses } from '../utils';
|
||||
import type { PyodideInterface } from '../pyodide';
|
||||
// Premise used to connect to the first available pyodide interpreter
|
||||
let runtime;
|
||||
let environments;
|
||||
let environments: Record<Environment['id'], Environment> = {};
|
||||
let currentMode;
|
||||
let Element;
|
||||
|
||||
|
||||
@@ -101,9 +101,10 @@ export class PyodideRuntime extends Object {
|
||||
pyodide.globals.set('pyscript_loader', loader);
|
||||
|
||||
loader?.log('Runtime created...');
|
||||
loadedEnvironments.update((value: any): any => {
|
||||
value[newEnv['id']] = newEnv;
|
||||
});
|
||||
loadedEnvironments.update(environments => ({
|
||||
...environments,
|
||||
[newEnv['id']]: newEnv,
|
||||
}));
|
||||
|
||||
// now we call all initializers before we actually executed all page scripts
|
||||
loader?.log('Initializing components...');
|
||||
|
||||
@@ -5,14 +5,14 @@ import { keymap } from '@codemirror/view';
|
||||
import { defaultKeymap } from '@codemirror/commands';
|
||||
import { oneDarkTheme } from '@codemirror/theme-one-dark';
|
||||
|
||||
import { componentDetailsNavOpen, loadedEnvironments, mode, pyodideLoaded } from '../stores';
|
||||
import { componentDetailsNavOpen, loadedEnvironments, mode, pyodideLoaded, type Environment } from '../stores';
|
||||
import { addClasses, htmlDecode } from '../utils';
|
||||
import { BaseEvalElement } from './base';
|
||||
|
||||
// Premise used to connect to the first available pyodide interpreter
|
||||
|
||||
let pyodideReadyPromise;
|
||||
let environments;
|
||||
let environments: Record<Environment['id'], Environment> = {};
|
||||
let currentMode;
|
||||
|
||||
pyodideLoaded.subscribe(value => {
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
loadedEnvironments,
|
||||
mode,
|
||||
pyodideLoaded,
|
||||
type Environment,
|
||||
} from '../stores';
|
||||
import { addClasses, htmlDecode } from '../utils';
|
||||
import { BaseEvalElement } from './base';
|
||||
@@ -12,7 +13,7 @@ import type { PyodideInterface } from '../pyodide';
|
||||
|
||||
// Premise used to connect to the first available pyodide interpreter
|
||||
let pyodideReadyPromise;
|
||||
let environments;
|
||||
let environments: Record<Environment['id'], Environment> = {};
|
||||
let currentMode;
|
||||
|
||||
pyodideLoaded.subscribe(value => {
|
||||
|
||||
Reference in New Issue
Block a user