Skip to content

Commit 32015d2

Browse files
jakearchibaldannevk
authored andcommitted
Simplify functional events
Follows w3c/ServiceWorker#1199.
1 parent 1733e39 commit 32015d2

File tree

1 file changed

+17
-28
lines changed

1 file changed

+17
-28
lines changed

notifications.bs

+17-28
Original file line numberDiff line numberDiff line change
@@ -522,13 +522,8 @@ specified) run these steps:
522522
<li><p>If one of <var>notification</var>'s <a for=notification>actions</a> was activated by the
523523
user, then set <var>action</var> to that <a for=notification>action</a>'s <a for=action>name</a>.
524524

525-
<li><p>Let <var>callback</var> be an algorithm that when invoked with a <var>global</var>,
526-
<a lt="fire a service worker notification event named e">fires a service worker notification event</a>
527-
named <code>notificationclick</code> given <var>notification</var> and <var>action</var> on
528-
<var>global</var>.
529-
530-
<li><p>Then run <a>Handle Functional Event</a> with <var>notification</var>'s
531-
<a for=notification>service worker registration</a> and <var>callback</var>.
525+
<li><a>Fire a service worker notification event</a> named "<code>notificationclick</code>" given
526+
<var>notification</var> and <var>action</var>.
532527
</ol>
533528

534529
<li>
@@ -571,18 +566,9 @@ must be run.
571566
<p>To <dfn>handle close events</dfn> given a <var>notification</var>, run these steps:
572567

573568
<ol>
574-
<li>
575-
<p>If <var>notification</var> is a <a>persistent notification</a> and
576-
<var>notification</var> was closed by the user, then:
577-
578-
<ol>
579-
<li><p>Let <var>callback</var> be an algorithm that when invoked with a <var>global</var>,
580-
<a lt="fire a service worker notification event named e">fires a service worker notification event</a>
581-
named <code>notificationclose</code> given <var>notification</var> on <var>global</var>.
582-
583-
<li><p>Then run <a>Handle Functional Event</a> with <var>notification</var>'s
584-
<a for=notification>service worker registration</a> and <var>callback</var>.
585-
</ol>
569+
<li><p>If <var>notification</var> is a <a>persistent notification</a> and <var>notification</var>
570+
was closed by the user, then <a>fire a service worker notification event</a> named
571+
"<code>notificationclose</code>" given <var>notification</var>.
586572

587573
<li><p>If <var>notification</var> is a <a>non-persistent notification</a>, then <a>queue a task</a>
588574
to <a>fire an event</a> named <code>close</code> on the {{Notification}} object representing
@@ -1083,13 +1069,18 @@ the same underlying <a>notification</a> of {{Notification}} objects already in e
10831069

10841070
<hr>
10851071

1086-
<p>To <dfn>fire a service worker notification event named <var>e</var></dfn>
1087-
given <var>notification</var> and <var>action</var>,
1088-
<a>fire an event</a> named <var>e</var>, using {{NotificationEvent}}, with the
1089-
{{NotificationEvent/notification}} attribute initialized to a new
1090-
{{Notification}} object representing <var>notification</var> and the
1091-
{{NotificationEvent/action}} attribute initialized to <var>action</var>.
1092-
<!-- XXX need to define at what the event is fired -->
1072+
<p>To <dfn>fire a service worker notification event</dfn> named <var>name</var> given
1073+
<var>notification</var> (a <a>notification</a>), and an optional <var>action</var> (a DOMString,
1074+
defaulting to the empty string), <a>Fire Functional Event</a> <var>name</var> using
1075+
{{NotificationEvent}} on <var>notification</var>'s
1076+
<a for=notification>service worker registration</a> with the following properties:
1077+
1078+
<dl>
1079+
<dt>{{NotificationEvent/notification}}
1080+
<dd>A new {{Notification}} object representing <var>notification</var>.
1081+
<dt>{{NotificationEvent/action}}
1082+
<dd><var>action</var>
1083+
</dl>
10931084

10941085
<p>The {{NotificationEvent/notification}} attribute's getter must return the
10951086
value it was initialized to.
@@ -1165,8 +1156,6 @@ by John Gregg (<a href=https://www.google.com/>Google</a>,
11651156
urlPrefix: https://html.spec.whatwg.org/multipage/
11661157
urlPrefix: webappapis.html; type: dfn
11671158
text: entry settings object
1168-
urlPrefix: https://w3c.github.io/ServiceWorker/; type: dfn
1169-
text: handle functional event; url:handle-functional-event-algorithm
11701159
urlPrefix: https://w3c.github.io/vibration/
11711160
urlPrefix: #dfn-; type: dfn
11721161
text: perform vibration

0 commit comments

Comments
 (0)