FEATURE: Use new Badging API

Now that the spec is finished use the unprefixed API, which was also moved
from window to navigator.

Still uses feature detection so it fail gracefully when not available in
the user agent.
This commit is contained in:
Rafael dos Santos Silva 2020-01-10 13:41:35 -03:00
parent 3ddebc61a9
commit 5a70f50032
No known key found for this signature in database
GPG Key ID: 5E50360227B34938
1 changed files with 2 additions and 2 deletions

View File

@ -4,7 +4,7 @@ export default {
after: "message-bus",
initialize(container) {
if (!window.ExperimentalBadge) return; // must have the Badging API
if (!navigator.setAppBadge) return; // must have the Badging API
const user = container.lookup("current-user:main");
if (!user) return; // must be logged in
@ -18,6 +18,6 @@ export default {
},
_updateBadge() {
window.ExperimentalBadge.set(this.notifications);
navigator.setAppBadge(this.notifications);
}
};