Skip to content

Commit b7dc668

Browse files
committed
Display a notification with body and actions
1 parent 61f3767 commit b7dc668

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

client/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,16 @@ const client = (() => {
88
};
99

1010
const showNotification = () => {
11+
const options = {
12+
body: 'This is an important body!',
13+
actions: [
14+
{action: 'search', title: 'Try Searching!'},
15+
{action: 'close', title: 'Forget it!'},
16+
]
17+
};
18+
1119
navigator.serviceWorker.getRegistration()
12-
.then(registration => registration.showNotification('My First Notification'));
20+
.then(registration => registration.showNotification('My First Notification', options));
1321
};
1422

1523
const checkNotificationSupport = () => {

0 commit comments

Comments
 (0)