diff --git a/src/NotificationAPI.res b/src/NotificationAPI.res index 315c099..9931e96 100644 --- a/src/NotificationAPI.res +++ b/src/NotificationAPI.res @@ -86,6 +86,10 @@ type notificationOptions = { mutable requireInteraction?: bool, mutable data?: JSON.t, mutable actions?: array, + /** + [Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/showNotification#vibrate) + */ + mutable vibrate?: array, } type getNotificationOptions = {mutable tag?: string} diff --git a/tests/NotificationsAPI/Notification__test.res b/tests/NotificationsAPI/Notification__test.res index 1e5d853..d2f8a61 100644 --- a/tests/NotificationsAPI/Notification__test.res +++ b/tests/NotificationsAPI/Notification__test.res @@ -10,4 +10,4 @@ Notification.requestPermission() | Default => Console.log("Permission default") } }) -->Promise.done +->Promise.ignore diff --git a/tests/ServiceWorkerAPI/ServiceWorker__test.js b/tests/ServiceWorkerAPI/ServiceWorker__test.js index d3e2f39..06c1497 100644 --- a/tests/ServiceWorkerAPI/ServiceWorker__test.js +++ b/tests/ServiceWorkerAPI/ServiceWorker__test.js @@ -52,6 +52,13 @@ self.addEventListener("push", event => { action: "close", title: "Close" } + ], + vibrate: [ + 200, + 50, + 200, + 50, + 400 ] }); }); diff --git a/tests/ServiceWorkerAPI/ServiceWorker__test.res b/tests/ServiceWorkerAPI/ServiceWorker__test.res index 8d274a1..aa56074 100644 --- a/tests/ServiceWorkerAPI/ServiceWorker__test.res +++ b/tests/ServiceWorkerAPI/ServiceWorker__test.res @@ -28,9 +28,10 @@ self->ServiceWorkerGlobalScope.addEventListener(EventAPI.Push, (event: PushAPI.p actions: [{action: "open", title: "Open"}, {action: "close", title: "Close"}], // For example the id of a new data entry data: JSON.Number(17.), + vibrate: [200, 50, 200, 50, 400], }, ) - ->Promise.done + ->Promise.ignore }) self->ServiceWorkerGlobalScope.addEventListener(EventAPI.NotificationClick, ( @@ -51,6 +52,6 @@ self->ServiceWorkerGlobalScope.addEventListener(EventAPI.NotificationClick, ( ->Option.forEach(id => { self.clients ->Clients.openWindow(`https://mywebsite.com/mydata/${id}`) - ->Promise.done + ->Promise.ignore }) })