ServiceWorkerRegistration.getNotifications(ok)
https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/getNotifications
Cú pháp
serviceWorkerRegistration.getNotifications(options)
.then(function(notificationsList) { ... });Thông số
Giá trị trả về
Thí dụ
navigator.serviceWorker.register('sw.js');
var options = { tag : 'user_alerts' };
navigator.serviceWorker.ready.then(function(registration) {
registration.getNotifications(options).then(function(notifications) {
// do something with your notifications
})
});PreviousServiceWorkerGlobalScope.onnotificationclick (ok)NextServiceWorkerRegistration.showNotification(ok)
Last updated