Skip to content

Commit e913d61

Browse files
authored
fix: Update background-only function description in AGENTS.md (#527)
Clarify background-only function requirements in documentation. Signed-off-by: xuanyi-fu <[email protected]>
1 parent 825d244 commit e913d61

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/public/AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
- **Dual-thread parallel rendering**: The main thread renders ReactLynx output immediately for the first screen, while the background thread constructs the full node tree and syncs state back to the main thread to avoid a white screen. (See [Rendering Process and Lifecycle](/react/lifecycle.md), [IFR](/guide/interaction/ifr.md))
3232
- **“Your code runs on two threads”**: Dual-thread React means your logic can run on both threads. However, not all code can execute in both environments—some APIs are only available on the background thread, and ReactLynx only executes events, lifecycle hooks, and `useEffect`-style side effects from the background thread.
33-
- **`'background only'`**: Any function that does not need to run on the main thread (for example event handlers, lifecycle hooks, side effects) or that touches background-only APIs must add `'background only'` as the first statement. Modules can declare `import "background-only"` to indicate they expect to run exclusively on the background thread.
33+
- **`'background only'`**: Any function **except a function component** that does not need to run on the main thread (for example event handlers, lifecycle hooks, side effects) or that touches background-only APIs must add `'background only'` as the first statement. Modules can declare `import "background-only"` to indicate they expect to run exclusively on the background thread.
3434
- **Main Thread Script (MTS)**: Functions marked with the `'main thread';` directive run directly on the main thread, ideal for high-frequency gestures, animations, and zero-delay feedback. Main-thread events must use the `main-thread:` prefix (for example `main-thread:bindtap`, `useMainThreadRef`). (See [Main Thread Script](/react/main-thread-script.md))
3535
- **Cross-thread communication**: Use `runOnMainThread` and `runOnBackground` for asynchronous cross-thread calls. Arguments must be JSON-serializable.
3636

0 commit comments

Comments
 (0)