rescript-notifications
This package closely wraps the web
Notifications API.
It will not include the Notification API Service Worker Additions. Instead,
it will be a dependency of the forthcoming rescript-service-worker
.
This package
has not been exhaustively tested. Please open issues.
Installation
npm install rescript-notifications
Implemented
- [X] ExtendableEvent
- [X] Notification
- [X] NotificationAction
- [X] NotificationEvent
- [X] NotificationEventInit
- [X] NotificationOptions
- [X] NotificationPermission
Notes
'data
You'll notice these types often have a generic type parameter 'data
. This
represents the data
property of the NotificationOptions passed into the
Notification constructor. It can be any structured clonable type, though, not
any type.
ExtendableEvent
This interface is technically considered part of the Service Worker API, but I've included it here instead to break the circular dependency between Service Worker API and Notifications API. In my small universe, rescript-service-worker will depend on bs-notifications, one way.
Examples
Read this article, which documents how to use the binding including a live demo.
Contributing
I'm a beginner. I'd be surprised if all of this were definitely right. @ me or send me a PR if you find anything you think I should take a second look at. (Stylistically, though, I'll warn you I'm pretty dug in, at least for now)
For further reading
I strongly recommend you check out my catch-all documentation on my projects. It describes how to get in touch with me if you have any questions, how to contribute code, coordinated disclosure of security vulnerabilities, and more. It will be regularly updated with any information I deem relevant to my side projects.
License
This software is available under two licenses.
- an adaptation of the Do No Harm license which I've called the No Violence license.
- the MIT license.
Both are available in this directory.