Skip to content

Commit 04fc7b0

Browse files
committed
Add vibrate to notificationOptions
1 parent c882807 commit 04fc7b0

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

Diff for: src/NotificationAPI.res

+4
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ type notificationOptions = {
8686
mutable requireInteraction?: bool,
8787
mutable data?: JSON.t,
8888
mutable actions?: array<notificationAction>,
89+
/**
90+
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/showNotification#vibrate)
91+
*/
92+
mutable vibrate?: array<int>,
8993
}
9094

9195
type getNotificationOptions = {mutable tag?: string}

Diff for: tests/NotificationsAPI/Notification__test.res

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ Notification.requestPermission()
1010
| Default => Console.log("Permission default")
1111
}
1212
})
13-
->Promise.done
13+
->Promise.ignore

Diff for: tests/ServiceWorkerAPI/ServiceWorker__test.js

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: tests/ServiceWorkerAPI/ServiceWorker__test.res

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ self->ServiceWorkerGlobalScope.addEventListener(EventAPI.Push, (event: PushAPI.p
2828
actions: [{action: "open", title: "Open"}, {action: "close", title: "Close"}],
2929
// For example the id of a new data entry
3030
data: JSON.Number(17.),
31+
vibrate: [200, 50, 200, 50, 400],
3132
},
3233
)
33-
->Promise.done
34+
->Promise.ignore
3435
})
3536

3637
self->ServiceWorkerGlobalScope.addEventListener(EventAPI.NotificationClick, (
@@ -51,6 +52,6 @@ self->ServiceWorkerGlobalScope.addEventListener(EventAPI.NotificationClick, (
5152
->Option.forEach(id => {
5253
self.clients
5354
->Clients.openWindow(`https://mywebsite.com/mydata/${id}`)
54-
->Promise.done
55+
->Promise.ignore
5556
})
5657
})

0 commit comments

Comments
 (0)