Rename editor_api.rs -> editor_wrapper.rs (#3926)

This commit is contained in:
Keavon Chambers
2026-03-21 03:34:08 -07:00
committed by GitHub
parent 087b4cd71f
commit 4a0c2016e6
7 changed files with 13 additions and 8 deletions

View File

@@ -39,6 +39,11 @@ The frontend is the GUI for Graphite which users see and interact with. It is bu
## Crate dependency graph
```sh
# Access this quickly in the future:
cargo run explore deps
```
This diagram shows the structure of the crates that comprise the Graphite codebase and how they depend on each other. Every Arrow points from a crate to another which it depends on.
<div class="crate-hierarchy">
@@ -49,7 +54,7 @@ This diagram shows the structure of the crates that comprise the Graphite codeba
## Frontend/backend communication
Frontend-to-backend communication is achieved through a thin Rust translation layer in [`/frontend/wasm/src/editor_api.rs`](https://github.com/GraphiteEditor/Graphite/tree/master/frontend/wasm/src/editor_api.rs) which wraps the editor backend's Rust-based message system API and provides the TypeScript-compatible API of callable functions. These wrapper functions are compiled by [wasm-bindgen](https://github.com/rustwasm/wasm-bindgen) into autogenerated TS functions that serve as an entry point from TS into the Wasm binary.
Frontend-to-backend communication is achieved through a thin Rust translation layer in [`/frontend/wasm/src/editor_wrapper.rs`](https://github.com/GraphiteEditor/Graphite/tree/master/frontend/wasm/src/editor_wrapper.rs) which wraps the editor backend's Rust-based message system API and provides the TypeScript-compatible API of callable functions. These wrapper functions are compiled by [wasm-bindgen](https://github.com/rustwasm/wasm-bindgen) into autogenerated TS functions that serve as an entry point from TS into the Wasm binary.
Backend-to-frontend communication happens by sending a queue of messages to the frontend message dispatcher. After the TS has called any wrapper API function to get into backend code execution, the editor's business logic runs and queues up each [`FrontendMessage`](https://github.com/GraphiteEditor/Graphite/tree/master/editor/src/messages/frontend/frontend_message.rs) which get mapped from Rust to JavaScript data structures in [`/frontend/src/messages.ts`](https://github.com/GraphiteEditor/Graphite/tree/master/frontend/src/messages.ts). Various TS code subscribes to these messages by calling: