demo · v132
PushMessageData.bytes() — equivalence demo
Real Push messages come from the server, but the PushMessageData interface is constructible-equivalent: any Body. Type a payload below to build a fake PushMessageData-shaped object and inspect what bytes() returns, side-by-side with the old arrayBuffer() + new Uint8Array() pattern.
checking support…
response.bytes() — new
—
arrayBuffer() → Uint8Array — old
—
service worker shape
self.addEventListener("push", e => {
const u8 = e.data.bytes(); // Uint8Array
const json = JSON.parse(new TextDecoder().decode(u8));
});
see also
- PushMessageData::bytes() — feature index
- ChromeStatus entry
- Spec