Skip to content

Commit 4e30b5f

Browse files
committed
Clarify serialization.
1 parent 7c72b23 commit 4e30b5f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ const MyComponent = () => (
8181

8282
- `url` {string} (required) Public url to the Web Worker file (or path relative to the root of your domain)
8383
- `options` {Object} Options passed to the Worker constructor
84-
- `parser` {Function} Transforms incoming messages (not errors)
84+
- `parser` {Function} Transforms incoming message data (not errors)
8585
- `serializer` {Function} Transforms `postMessage` payload before sending
8686
- `onMessage` {Function} Callback function invoked when a message is received, passing message data as argument
8787
- `onError` {Function} Callback function invoked when an error is received, passing error object as argument
@@ -100,8 +100,8 @@ const MyComponent = () => (
100100
- `postMessage` {Function} sends a message to the Web Worker
101101

102102
> Note: [it's recommended](https://nolanlawson.com/2016/02/29/high-performance-web-worker-messages/) to send and receive
103-
> JSON strings instead of JS objects for improved performance. `<WebWorker>` can't do this for you, so you'll have to
104-
> stringify and parse message data yourself if you care about performance.
103+
> JSON strings instead of JS objects for improved performance. You can use the `parser` and `serializer` props to have
104+
> `<WebWorker>` deal with this on the client side, but your Worker must still (de)serialize messages on its end.
105105
106106
## Examples
107107

0 commit comments

Comments
 (0)