DEV Community

Discussion on: Seamless web workers & worker threads - threads.js

Collapse
andywer profile image
Andy Wermke Author

Hi! It uses worker.postMessage() to post an unserialized object, since this is the fastest option. The browser / node.js can then determine what’s the most efficient way to pass the data.

For a worker invocation myWorker.print({ foo: "bar" }) the posted data would look roughly like this: { callID: 27, method: "print", args: [{ foo: "bar" }] }