Skip to content

Commit

Permalink
Define all members and correct some minor errors
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed Nov 7, 2024
1 parent d564f28 commit 8554a68
Showing 1 changed file with 247 additions and 28 deletions.
275 changes: 247 additions & 28 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,19 @@ <h2>
}
}
</pre>
<section>
<h3>
Miscellaneous
</h3>
<p>
A <dfn>64-bit unsigned integer</dfn> is an integer in the range 0 to
18446744073709551615 (2<sup>64</sup> − 1), inclusive.
</p>
<p>
A <dfn>32-bit unsigned integer</dfn> is an integer in the range 0 to 4294967295
(2<sup>32</sup> − 1), inclusive.
</p>
</section>
<section>
<h3>
Members
Expand All @@ -217,8 +230,10 @@ <h3>
</dt>
<dd>
<p>
A JSON object consisting of the following members, many being analogous to
Notifications API features. [[NOTIFICATIONS]]
A JSON object consisting of the following members, all analogous to Notifications
API features, though sometimes with a slightly stricter type. Apart from
<code>title</code> all members are derived from the {{NotificationOptions}}
dictionary and are expected to be maintained in tandem. [[NOTIFICATIONS]]
</p>
<dl>
<dt>
Expand Down Expand Up @@ -254,7 +269,7 @@ <h3>
</p>
</dd>
<dt>
<code>url</code> (required)
<code>navigate</code> (required)
</dt>
<dd>
<p>
Expand All @@ -269,6 +284,14 @@ <h3>
A string.
</p>
</dd>
<dt>
<code>image</code>
</dt>
<dd>
<p>
A string that holds a URL.
</p>
</dd>
<dt>
<code>icon</code>
</dt>
Expand All @@ -277,6 +300,38 @@ <h3>
A string that holds a URL.
</p>
</dd>
<dt>
<code>badge</code>
</dt>
<dd>
<p>
A string that holds a URL.
</p>
</dd>
<dt>
<code>vibrate</code>
</dt>
<dd>
<p>
An array of [=32-bit unsigned integers=].
</p>
</dd>
<dt>
<code>timestamp</code>
</dt>
<dd>
<p>
A [=64-bit unsigned integer=].
</p>
</dd>
<dt>
<code>renotify</code>
</dt>
<dd>
<p>
A boolean.
</p>
</dd>
<dt>
<code>silent</code>
</dt>
Expand All @@ -285,6 +340,14 @@ <h3>
A boolean.
</p>
</dd>
<dt>
<code>require_interaction</code>
</dt>
<dd>
<p>
A boolean.
</p>
</dd>
<dt>
<code>data</code>
</dt>
Expand All @@ -293,14 +356,57 @@ <h3>
Any JSON value.
</p>
</dd>
<dt>
<code>actions</code>
</dt>
<dd>
<p>
An array of JSON objects consisting of the following members, all derived from
the {{NotificationAction}} dictionary and to be maintained in tandem.
</p>
<dl>
<dt>
<code>action</code> (required)
</dt>
<dd>
<p>
A string.
</p>
</dd>
<dt>
<code>title</code> (required)
</dt>
<dd>
<p>
A string.
</p>
</dd>
<dt>
<code>navigate</code> (required)
</dt>
<dd>
<p>
A string that holds a URL.
</p>
</dd>
<dt>
<code>icon</code>
</dt>
<dd>
<p>
A string that holds a URL.
</p>
</dd>
</dl>
</dd>
</dl>
</dd>
<dt>
<code>app_badge</code>
</dt>
<dd>
<p>
An integer in the range 0 to 18446744073709551615 (2<sup>64</sup> − 1), inclusive.
A [=64-bit unsigned integer=].
</p>
<p class="note">
Platform conventions are likely to impose a lower limit with regards to what is
Expand Down Expand Up @@ -350,12 +456,8 @@ <h3>
</li>
<li>
<p>
If <var>message</var>["`web_push`"] does not [=map/exist=], then return failure.
</p>
</li>
<li>
<p>
If <var>message</var>["`web_push`"] is not 8030, then return failure.
If <var>message</var>["`web_push`"] does not [=map/exist=] or is not 8030, then
return failure.
</p>
</li>
<li>
Expand Down Expand Up @@ -399,24 +501,21 @@ <h3>
</li>
<li>
<p>
If <var>notificationInput</var>["`dir`"] [=map/exists=] and
<var>notificationInput</var>["`dir`"] is "`auto`", "`ltr`", or "`rtl`", then set
<var>notificationOptions</var>["{{NotificationOptions/dir}}"] to
<var>notificationInput</var>["`dir`"].
If <var>notificationInput</var>["`dir`"] [=map/exists=] and is "`auto`", "`ltr`",
or "`rtl`", then set <var>notificationOptions</var>["{{NotificationOptions/dir}}"]
to <var>notificationInput</var>["`dir`"].
</p>
</li>
<li>
<p>
If <var>notificationInput</var>["`lang`"] [=map/exists=] and
<var>notificationInput</var>["`lang`"] is a string, then set
If <var>notificationInput</var>["`lang`"] [=map/exists=] and is a string, then set
<var>notificationOptions</var>["{{NotificationOptions/lang}}"] to
<var>notificationInput</var>["`lang`"].
</p>
</li>
<li>
<p>
If <var>notificationInput</var>["`body`"] [=map/exists=] and
<var>notificationInput</var>["`body`"] is a string, then set
If <var>notificationInput</var>["`body`"] [=map/exists=] and is a string, then set
<var>notificationOptions</var>["{{NotificationOptions/body}}"] to
<var>notificationInput</var>["`body`"].
</p>
Expand All @@ -429,28 +528,70 @@ <h3>
</li>
<li>
<p>
If <var>notificationInput</var>["`tag`"] [=map/exists=] and
<var>notificationInput</var>["`tag`"] is a string, then set
If <var>notificationInput</var>["`tag`"] [=map/exists=] and is a string, then set
<var>notificationOptions</var>["{{NotificationOptions/tag}}"] to
<var>notificationInput</var>["`tag`"].
</p>
</li>
<li>
<p>
If <var>notificationInput</var>["`icon`"] [=map/exists=] and
<var>notificationInput</var>["`icon`"] is a string, then set
If <var>notificationInput</var>["`image`"] [=map/exists=] and is a string, then set
<var>notificationOptions</var>["{{NotificationOptions/image}}"] to
<var>notificationInput</var>["`image`"], [=string/converted=].
</p>
</li>
<li>
<p>
If <var>notificationInput</var>["`icon`"] [=map/exists=] and is a string, then set
<var>notificationOptions</var>["{{NotificationOptions/icon}}"] to
<var>notificationInput</var>["`icon`"], [=string/converted=].
</p>
</li>
<li>
<p>
If <var>notificationInput</var>["`silent`"] [=map/exists=] and
<var>notificationInput</var>["`silent`"] is a boolean, then set
<var>notificationOptions</var>["{{NotificationOptions/silent}}"] to
If <var>notificationInput</var>["`badge`"] [=map/exists=] and is a string, then set
<var>notificationOptions</var>["{{NotificationOptions/badge}}"] to
<var>notificationInput</var>["`badge`"], [=string/converted=].
</p>
</li>
<li>
<p>
If <var>notificationInput</var>["`vibrate`"] [=map/exists=] and is a [=/list=] of
which each [=list/item=] is a [=32-bit unsigned integer=], then set
<var>notificationOptions</var>["{{NotificationOptions/vibrate}}"] to
<var>notificationInput</var>["`vibrate`"].
</p>
</li>
<li>
<p>
If <var>notificationInput</var>["`timestamp`"] [=map/exists=] and is a [=64-bit
unsigned integer=], then set
<var>notificationOptions</var>["{{NotificationOptions/timestamp}}"] to
<var>notificationInput</var>["`timestamp`"].
</p>
</li>
<li>
<p>
If <var>notificationInput</var>["`renotify`"] [=map/exists=] and is a boolean, then
set <var>notificationOptions</var>["{{NotificationOptions/renotify}}"] to
<var>notificationInput</var>["`renotify`"].
</p>
</li>
<li>
<p>
If <var>notificationInput</var>["`silent`"] [=map/exists=] and is a boolean, then
set <var>notificationOptions</var>["{{NotificationOptions/silent}}"] to
<var>notificationInput</var>["`silent`"].
</p>
</li>
<li>
<p>
If <var>notificationInput</var>["`require_interaction`"] [=map/exists=] and is a
boolean, then set
<var>notificationOptions</var>["{{NotificationOptions/requireInteraction}}"] to
<var>notificationInput</var>["`require_interaction`"].
</p>
</li>
<li>
<p>
If <var>notificationInput</var>["`data`"] [=map/exists=], then set
Expand All @@ -459,6 +600,79 @@ <h3>
<var>notificationInput</var>["`data`"].
</p>
</li>
<li>
<p>
If <var>notificationInput</var>["`actions`"] [=map/exists=] and is a [=/list=]:
</p>
<ol>
<li>
<p>
Let <var>notificationActions</var> be « ».
</p>
</li>
<li>
<p>
[=list/For each=] <var>actionInput</var> of
<var>notificationInput</var>["`actions`"]:
</p>
<ol>
<li>
<p>
If <var>actionInput</var>["`action`"] does not [=map/exist=] or is not a
string, then [=iteration/continue=].
</p>
</li>
<li>
<p>
If <var>actionInput</var>["`title`"] does not [=map/exist=] or is not a
string, then [=iteration/continue=].
</p>
</li>
<li>
<p>
If <var>actionInput</var>["`navigate`"] does not [=map/exist=] or is not a
string, then [=iteration/continue=].
</p>
</li>
<!-- We still need to check the final action for a navigation URL regardless, but failing early seems good as per above. -->
<li>
<p>
Let <var>actionNavigate</var> be <var>actionInput</var>["`navigate`"],
[=string/converted=].
</p>
</li>
<li>
<p>
Let <var>notificationAction</var> be the {{NotificationAction}} dictionary
«[ "{{NotificationAction/action}}" → <var>actionInput</var>["`action`"],
"{{NotificationAction/title}}" → <var>actionInput</var>["`title`"],
"{{NotificationAction/navigate}}" → <var>actionNavigate</var> ]».
</p>
</li>
<!-- Initialize the dictionary mostly at once here to account for required members. -->
<li>
<p>
If <var>actionInput</var>["`icon`"] [=map/exists=] and is a string, then
set <var>notificationAction</var>["{{NotificationAction/icon}}"] to
<var>actionInput</var>["`icon`"], [=string/converted=].
</p>
</li>
<li>
<p>
[=list/Append=] <var>notificationAction</var> to
<var>notificationActions</var>.
</p>
</li>
</ol>
</li>
<li>
<p>
Set <var>notificationOptions</var>["{{NotificationOptions/actions}}"] to
<var>notificationActions</var>.
</p>
</li>
</ol>
</li>
<li>
<p>
Let <var>notification</var> be the result of <a data-lt=
Expand All @@ -474,6 +688,12 @@ <h3>
failure.
</p>
</li>
<li>
<p>
If the [=action/navigation URL=] of any [=/action=] of <var>notification</var>'s
[=notification/actions=] is null, then return failure.
</p>
</li>
<li>
<p>
Let <var>appBadge</var> be null.
Expand All @@ -482,9 +702,8 @@ <h3>
<li>
<p>
If <var>message</var>["`app_badge`"] [=map/exists=] and
<var>message</var>["`app_badge`"] is an integer in the range 0 to
18446744073709551615 (2<sup>64</sup> − 1), inclusive, then set <var>appBadge</var>
to <var>message</var>["`app_badge`"].
<var>message</var>["`app_badge`"] is a [=64-bit unsigned integer=], then set
<var>appBadge</var> to <var>message</var>["`app_badge`"].
</p><!-- unsigned long long in Web IDL -->
</li>
<li>
Expand Down

0 comments on commit 8554a68

Please sign in to comment.