Notification: thuộc tính tĩnh maxActions

Khả dụng hạn chế

This feature is not Baseline because it does not work in some of the most widely-used browsers.

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

Note: This feature is available in Web Workers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Thuộc tính tĩnh chỉ đọc maxActions của giao diện Notification trả về số lượng hành động tối đa được thiết bị và User Agent hỗ trợ. Về mặt thực tế, đây là số phần tử tối đa trong mảng Notification.actions mà User Agent sẽ tôn trọng.

Giá trị

Một số nguyên cho biết số lượng hành động thông báo lớn nhất mà User Agent và thiết bị có thể trình bày cho người dùng.

Ví dụ

Đoạn mã sau ghi lại số lượng hành động được hỗ trợ tối đa.

js
const maxActions = Notification.maxActions;
console.log(
  `Thiết bị này có thể hiển thị tối đa ${maxActions} hành động trên mỗi thông báo.`,
);

Thông số kỹ thuật

Thông số kỹ thuật
Notifications API
# dom-notification-maxactions

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

Xem thêm