← Back to release summary

Options dictionary for postMessage methods

Category
DOM
Type
New or changed feature
Status
Enabled by default (Chrome 70)
Intent stage
None

Summary

An optional PostMessageOptions object is being added to the postMessage() function for 6 of the 7 interfaces where it’s supported, specifically, DedicatedWorkerGlobalScope, Worker, ServiceWorker, ServiceWorker, and Window. This gives the function a similar interface on its definitions and allows it to be extended in the future. Since broadcastChannel.postMessage() doesn't take additional arguments (such as transfer) it is not being changed.

Standards & signals

Docs: https://github.com/w3c/ServiceWorker/pull/1344

Samples: https://gist.github.com/dtapuska/bd92755849991c2fd9b87e1d46691321

View on chromestatus.com