@yiin/reactive-proxy-state 1.0.27 → 1.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -80,6 +80,14 @@ onServerEvent((event) => {
80
80
  serverState.count = 5; // Automatically synced to all clients
81
81
  ```
82
82
 
83
+ If you need to relay state or events through `postMessage`, workers, or any structured-clone boundary, convert them first:
84
+
85
+ ```typescript
86
+ import { deepToRaw } from "@yiin/reactive-proxy-state";
87
+
88
+ worker.postMessage(deepToRaw(serverState));
89
+ ```
90
+
83
91
  See the [`updateState` documentation](./docs/api/update-state.md) and [`reactive` documentation](./docs/api/reactive.md) for more details on event emission and application.
84
92
 
85
93
  ## API
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Converts reactive proxies/refs into plain JavaScript data structures
3
+ * so they can be safely sent across structured-clone boundaries.
4
+ */
5
+ export declare function deepToRaw<T>(input: T, seen?: WeakMap<any, any>): T;