Contact emails
kno...@chromium.org, pe...@chromium.org
Explainer
https://github.com/beverloo/notification-triggers
Design doc
Notification Triggers Design Doc
Notifications API Standard: https://notifications.spec.whatwg.org/
We're still going through some rounds of internal review, a TAG review will be requested immediately after.
Summary
Allow Web Notifications to be shown at a later time in the future.
Motivation
With background sync/fetch APIs, Web Applications are increasingly getting offline capabilities. This is even more important when installed as a PWA. To show Notifications, apps can either show them immediately (requires users to have Chrome running), or as a response to a Push Message (requires network connectivity). There is no reliable way of showing a Notification for a scheduled meeting as a Web Application right now because receiving a Push Message is an unreliable and expensive operation on mobile devices. Having a declarative way of specifying when a Notification should be shown reduces the effort for developers and allows browsers to optimize this use case.
Risks
Interoperability and Compatibility
This feature takes another step at making Web Applications offline ready. This will allow use cases like calendars to be implemented as a PWA instead of a native Android app.
Edge: No signals
Firefox: No signals
Safari: No signals
Web / Framework developers: Asked for by multiple partners
Ergonomics
This feature will be used in offline capable applications. They will use other APIs targeted towards good offline experiences like Background Sync/Fetch.
Depending on how developers chose to work around this missing feature, we expect using this new API to be more resource efficient and improve reliability for users. It could also reduce the number of Push Messages required as applications can specify when the Notifications should be shown instead of having to send a Push Message at the right time.
Activation
This feature is an extension to the existing Notifications API. Developers can easily use this new capability by providing the new options to their existing calls to the Notifications API. Polyfills are not possible for this feature as it requires to schedule tasks on the underlying OS, although sending a push notification continues to be an option.
Debuggability
Notifications that are scheduled to be shown in the future via this API can be retrieved and removed using the existing Notifications API. This API will be extended to allow developers to list all scheduled notifications with their corresponding trigger. Notifications are not exposed to DevTools thus we do not plan to make any changes to it.
Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?
Yes. We will start with Android, but we intend to implement it for all platforms. Android WebView is excluded because notification support is not available there.
Link to entry on the feature dashboard
https://www.chromestatus.com/feature/5133150283890688
Requesting approval to ship?
No
Note that the PWA will only be notified when the user interacts with the notification as we do not run JavaScript when the specified time is reached. This would be more like a General Alarms API and not part of this one.- Richard