import { createPython } from "@elvis/pyodide"; import type { FunctionValues, RunSettings, State } from "./types"; // The methods of backend/src/manager.py's Manager export type OptimisationApi = { // variables is 1 or 2; clears the runs handle_set_function: { args: { variables: number; expression: string }; result: null }; // null when no function is set handle_function_values: { args: { x_range: number[]; y_range: number[] }; result: FunctionValues | null }; handle_set_runs: { args: { runs: RunSettings[] }; result: null }; // null once every run has stopped (or there are none) handle_state: { args: { iteration: number }; result: State | null }; }; export const python = createPython( new Worker(new URL("./pyodide.worker.ts", import.meta.url), { type: "module" }), );