Skip to main content

Module runner

Module runner 

Source
Expand description

CodeRunner 组件实现:源码 + 运行按钮 + SSE 流式输出 + xterm.js 终端。

编辑器挂载:组件在 WASM 端按自身 container_id 调用 codemirror_bridge::get_module().create(...) 挂载 CodeMirror,onChange 回写到内部 source_signaluse_drop 时销毁实例。范式镜像 SQL 控制台 (src/pages/admin/system.rs)与 Tiptap 编辑器(src/pages/admin/write.rs)。

输出渲染:WASM 端按 output_container_id 调用 xterm_bridge::get_module().create(...) 挂载 xterm.js 终端(输出专用,无 stdin),SSE stdout/stderr 事件实时写入。 SSE 不可用时降级到轮询 get_exec_result,整段写入终端(writeAll)。

Re-exports§

pub use CodeRunner_completions::Component::CodeRunner;

Structs§

CodeRunnerProps
Properties for the CodeRunner component.

Constants§

MAX_POLLS 🔒
轮询最大次数兜底,避免任务卡在 Running 状态时无限轮询。
POLL_INTERVAL_MS 🔒
轮询间隔(毫秒)。仅 server 端 run_code 占位路径使用。

Functions§

CodeRunner
代码运行器组件。
status_label 🔒
把 ExecStatus 映射成中文标签。