initial commit
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
---
|
||||
epic: 1
|
||||
story: 1.6
|
||||
title: "WASM Bindings (for Web)"
|
||||
status: draft
|
||||
---
|
||||
|
||||
## Epic 1 — Core Calculation Engine (Rust Crate)
|
||||
**Goal:** Build `calcpad-engine` as a standalone Rust crate that powers all platforms. This is the foundation.
|
||||
|
||||
### Story 1.6: WASM Bindings (for Web)
|
||||
|
||||
As a web developer integrating CalcPad,
|
||||
I want `wasm-bindgen` exports that return JSON-compatible results and fit within a 500KB gzipped bundle,
|
||||
So that the engine runs performantly in the browser without large download overhead.
|
||||
|
||||
**Acceptance Criteria:**
|
||||
|
||||
**Given** a JavaScript caller invoking the `eval_line` WASM export with a string input
|
||||
**When** the function executes
|
||||
**Then** it returns a `JsValue` that can be deserialized to a JavaScript object
|
||||
**And** the object includes `type`, `display`, `rawValue`, and `error` fields
|
||||
|
||||
**Given** a JavaScript caller invoking `eval_sheet` with an array of lines
|
||||
**When** the function executes
|
||||
**Then** it returns an array of result objects corresponding to each line
|
||||
**And** variable context flows from earlier lines to later lines
|
||||
|
||||
**Given** the WASM crate is built with `wasm-pack build --release`
|
||||
**When** the output `.wasm` file is gzip-compressed
|
||||
**Then** the compressed size is under 500KB
|
||||
|
||||
**Given** the WASM module is loaded in a browser environment
|
||||
**When** `eval_line` is called with `0.1 + 0.2`
|
||||
**Then** the result is `0.3` (arbitrary precision works in WASM)
|
||||
**And** performance is comparable to native for typical expressions (under 1ms per line)
|
||||
|
||||
**Given** the WASM module is loaded in a Web Worker
|
||||
**When** `eval_sheet` is called
|
||||
**Then** it does not block the main thread
|
||||
**And** results can be posted back via standard `postMessage`
|
||||
Reference in New Issue
Block a user