web api instance method
PushMessageData: bytes() method
Secure contextAvailable in workers
The bytes() method of the PushMessageData interface extracts push message data as a Uint8Array object.
Syntax
bytes()
Parameters
None.
Return value
A Uint8Array.
Exceptions
The returned Uint8Array is backed by an ArrayBuffer of bytes.
Exceptions thrown during creation of this backing buffer are re-thrown.
See TypedArray.
Examples
self.addEventListener("push", (event) => {
const buffer = event.data.bytes();
// do something with your typed array
});
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.