Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editorial: add "has showNotification() been successfully invoked" #227

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions notifications.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,12 @@ partial interface ServiceWorkerGlobalScope {
};
</pre>

<p>A <a for=/>service worker registration</a> has an associated
<dfn export for="service worker registration">has <code>showNotification()</code> been successfully invoked</dfn>
(a <a for=/>boolean</a>), which is initially false.

<p class=note>This is infrastructure for the <cite>Push API</cite> standard. [[PUSH-API]]

<div algorithm>
<p>The
<dfn method for=ServiceWorkerRegistration><code>showNotification(<var>title</var>, <var>options</var>)</code></dfn>
Expand Down Expand Up @@ -1098,6 +1104,10 @@ method steps are:

<li><p>Run the <a for=/>notification show steps</a> for <var>notification</var>.

<li><p>Set <var>notification</var>'s <a for=notification>service worker registration</a>'s
<a for="service worker registration">has <code>showNotification()</code> been successfully invoked</a>
to true.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing sets it back to false, perhaps the push event handler should set it false in w3c/push-api#385?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also wonder what would happen if another push event is fired before the previous one finishes, because then this value would conflict. Perhaps we could have PushEvent.showNotification() (where the default arg is the DWP parse result) to make it per-event? 🤔

Copy link
Member Author

@annevk annevk Mar 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I was waiting to see if this approach (which also means you have to process pushes sequentially) works for everyone, but then nobody gave feedback for what felt like an eternity…


<li><p><a>Queue a global task</a> on the <a>DOM manipulation task source</a> given
<var>global</var> to <a for=/>resolve</a> <var>promise</var> with undefined.
</ol>
Expand Down