So I read on MDN that the Notification API can only be used on an event initiated by the user. Doesn't this take away any need for this API at all? I can't think of any situation whatsoever where posting a Notification would ever be useful within a user event.
User hits a button: "Hey user, you hit a button! I'm telling you something you already know in the most obnoxious way possible! Hee hee. ^_^"
Are they just deprecating this, or is there still some functionality to it? Am I missing something?
I want to use it to actually notify the user that a note-worthy change has occurred in the state of the application. This is apparently now not a supported use case. Huzzah!
Update:
https://developer.mozilla.org/en-US/docs/Web/API/notification
Quote: "Note: In the above example we spawn notifications in response to a user gesture (clicking a button). This is not only best practice — you should not be spamming users with notifications they didn't agree to — but going forward browsers will explicitly disallow notifications not triggered in response to a user gesture. Firefox is already doing this from version 72, for example."
You've misread MDN.
https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API/Using_the_Notifications_API
Because of abuses of push notifications in the past, web browsers and developers have begun to implement strategies to help mitigate this problem. You should only request consent to display notifications in response to a user gesture (e.g. clicking a button). This is not only best practice — you should not be spamming users with notifications they didn't agree to — but going forward browsers will explicitly disallow notification permission requests not triggered in response to a user gesture. Firefox is already doing this from version 72, for example, and Safari has done it for some time.
This only affects the initial prompt to allow notifications.
Subsequent uses of the Notifications API (once the user selects 'allow') don't require user interactions.
There is a use such as you can make it say stuff you don't know, for example if you forgot your first passkey then you type in your second passkey to see your first passkey, or you can make it say something secret with it in some secretive game such as a ARG.