notifikasi

Tampilkan pemberitahuan kepada pengguna, menggunakan mekanisme pemberitahuan sistem operasi yang mendasarinya. Karena API ini menggunakan mekanisme pemberitahuan sistem operasi, detail tentang bagaimana pemberitahuan muncul dan berperilaku mungkin berbeda sesuai dengan sistem operasi dan pengaturan pengguna.

Untuk menggunakan API ini Anda harus memiliki izin "notifikasi"

Tipe

notifications.NotificationOptions
Menentukan isi pemberitahuan.
notifications.TemplateType
Jenis pemberitahuan. Misalnya, ini menentukan apakah pemberitahuan dapat memuat gambar.

Fungsi

notifications.clear()
Hapus pemberitahuan khusus, berikan ID-nya.
notifications.create()
Buat dan tampilkan pemberitahuan baru.
notifications.getAll()
Dapatkan semua notifikasi.
notifications.update()
Perbarui notifikasi

Events

notifications.onButtonClicked
Dipecat ketika pengguna mengklik tombol di notifikasi.
notifications.onClicked
Dipecat ketika pengguna mengklik pemberitahuan, tetapi tidak pada tombol.
notifications.onClosed
Dipecat ketika pemberitahuan ditutup, baik oleh sistem atau karena pengguna memecatnya.
notifications.onShown
Dipecat segera setelah pemberitahuan telah ditampilkan.

Kompatibilitas peramban

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxOperaFirefox for Android
NotificationOptionsChrome Full support YesEdge Full support 17Firefox Full support 45Opera Full support YesFirefox Android Full support 48
TemplateTypeChrome Full support YesEdge Full support 17Firefox Full support 45
Notes
Full support 45
Notes
Notes Only the 'basic' type is supported.
Opera Full support Yes
Notes
Full support Yes
Notes
Notes Only the 'basic' type is supported.
Firefox Android Full support 48
Notes
Full support 48
Notes
Notes Only the 'basic' type is supported.
clearChrome Full support 28Edge Full support 17Firefox Full support 45Opera Full support 25Firefox Android Full support 48
createChrome Full support 28Edge Full support 17Firefox Full support 45Opera Full support 25Firefox Android Full support 48
getAllChrome Full support 29Edge Full support 17Firefox Full support 45Opera Full support 25Firefox Android Full support 48
onButtonClickedChrome Full support 28Edge Full support 17Firefox No support NoOpera Full support 25Firefox Android No support No
onClickedChrome Full support 28Edge Full support 17Firefox Full support 47Opera Full support 25Firefox Android Full support 48
onClosedChrome Full support 28Edge Full support 17Firefox Full support 45Opera Full support 25Firefox Android Full support 48
onShownChrome No support NoEdge No support NoFirefox Full support 56Opera No support NoFirefox Android Full support 56
updateChrome Full support 28Edge Full support 17Firefox No support NoOpera Full support 25
Notes
Full support 25
Notes
Notes Not supported on Macs.
Firefox Android No support No

Legend

Full support  
Full support
No support  
No support
See implementation notes.
See implementation notes.
Ucapan terima kasih

API ini berdasarkan pada API Chromium chrome.notifications.