Notification: thuộc tính vibrate

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.

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

Note: This feature is available in Web Workers.

Thuộc tính chỉ đọc vibrate của giao diện Notification chỉ định một mẫu rung cho phần cứng rung của thiết bị sẽ phát khi thông báo được kích hoạt. Điều này được chỉ định trong tùy chọn vibrate của constructor Notification().

Giá trị

Một mẫu rung, như được chỉ định trong đặc tả Vibration API.

Ví dụ

Đoạn mã sau nhằm tạo một thông báo cũng kích hoạt rung trên thiết bị; một object options đơn giản được tạo, rồi thông báo được phát bằng constructor Notification().

js
const options = {
  body: "Your code submission has received 3 new review comments.",
  vibrate: [200, 100, 200],
};

const n = new Notification("New review activity", options);

console.log(n.vibrate); // [200, 100, 200]

Thông số kỹ thuật

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

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

Xem thêm