PushMessageData: phương thức blob()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2023.

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

Note: This feature is only available in Service Workers.

Phương thức blob() của giao diện PushMessageData trích xuất dữ liệu push message dưới dạng đối tượng Blob.

Cú pháp

js
blob()

Tham số

Không có.

Giá trị trả về

Một Blob.

Ví dụ

js
self.addEventListener("push", (event) => {
  const blob = event.data.blob();

  // làm gì đó với Blob của bạn
});

Thông số kỹ thuật

Specification
Push API
# dom-pushmessagedata-blob

Tương thích trình duyệt