diff --git a/index.html b/index.html index 603265b..18810a6 100644 --- a/index.html +++ b/index.html @@ -392,14 +392,26 @@

+
+ app_badge +
+
+

+ A [=/64-bit unsigned integer=]. +

+

+ Platform conventions are likely to impose a lower limit with regards to what is + displayed to the end user. [[BADGING]] +

+
mutable

A boolean. When true causes a push event to be dispatched to a service - worker (if any) containing the {{Notification}} object described by the - declarative push message. + worker (if any) containing the {{Notification}} object and app badge number (if + any) described by the declarative push message.

@@ -411,7 +423,8 @@

A declarative push message parser result is a [=/tuple=] consisting of a notification (a - [=/notification=]) and a app + badge (null or an integer), and a mutable (a boolean).

@@ -673,6 +686,18 @@

notification's [=notification/actions=] is null, then return failure.

+
  • +

    + Let appBadge be null. +

    +
  • +
  • +

    + If message["`app_badge`"] [=map/exists=] and + message["`app_badge`"] is a [=/64-bit unsigned integer=], then set + appBadge to message["`app_badge`"]. +

    +
  • Let mutable be false. @@ -687,7 +712,7 @@

  • - Return (notification, mutable). + Return (notification, appBadge, mutable).

  • @@ -1598,11 +1623,13 @@

    constructor(DOMString type, optional PushEventInit eventInitDict = {}); readonly attribute PushMessageData? data; readonly attribute Notification? notification; + readonly attribute unsigned long long? appBadge; }; dictionary PushEventInit : ExtendableEventInit { PushMessageDataInit? data = null; Notification? notification = null; + unsigned long long? appBadge = null; }; typedef (BufferSource or USVString) PushMessageDataInit; @@ -1629,6 +1656,9 @@

    The notification attribute must return the value it was initialized with.

    +

    + The appBadge attribute must return the value it was initialized with. +

    @@ -1715,6 +1745,11 @@

    Let |notificationShown| be false.

    +
  • +

    + Let |appBadgeSet| be false. +

    +
  • If |declarativeResult|'s [=declarative push message parser result/mutable=] @@ -1724,14 +1759,16 @@

  • Let |result| be the result of [=fire a push event|firing a push event=] - given |registration|, null, and a new {{Notification}} object - representing |notification|. + given |registration|, null, a new {{Notification}} object representing + |notification|, and |declarativeResult|'s [=declarative push message + parser result/app badge=].

  • If |result| is not failure, then set |notificationShown| to |result|'s - [=push event result/notification shown=]. + [=push event result/notification shown=] and |appBadgeSet| to |result|'s + [=push event result/app badge set=].

  • @@ -1742,6 +1779,12 @@

    given |notification|.

  • +
  • +

    + If |appBadgeSet| is false, then w3c/badging #111... +

    +
  • [=acknowledge a push message|Acknowledge=] the push message and abort @@ -1761,7 +1804,7 @@

  • Let |result| be the result of [=fire a push event|firing a push event=] given - |registration|, |data|, and null. + |registration|, |data|, null, and null.

  • @@ -1779,13 +1822,15 @@

  • - A push event result is a [=/tuple=] consisting of a notification shown (a [=/boolean=]). + A push event result is a [=/tuple=] consisting of a notification shown (a [=/boolean=]) and an app badge set (a [=/boolean=]).

    To fire a push event given a [=/service worker registration=] |registration|, - {{PushMessageData}} object or null |data|, and a [=/notification=] or null - |notification|, run these steps. They return failure or a [=/push event result=]. + {{PushMessageData}} object or null |data|, a [=/notification=] or null |notification|, + and an integer or null |appBadge|, run these steps. They return failure or a [=/push + event result=].

    1. @@ -1793,6 +1838,11 @@

      Let |notificationResult| be null.

    2. +
    3. +

      + Let |appBadgeResult| be null. +

      +
    4. Set |registration|'s [=service worker registration/has shownotification() been @@ -1817,6 +1867,12 @@

      |notification|
      +
      + {{PushEvent/appBadge}} +
      +
      + |appBadge| +

      Then run the following steps in parallel, with |dispatchedEvent|: @@ -1830,21 +1886,28 @@

    5. - If they do not resolve successfully, then set |notificationResult| to failure. + If they do not resolve successfully, then set |notificationResult| and + |appBadgeResult| to failure and abort these steps. +

      +
    6. +
    7. +

      + Set |notificationResult| to |registration|'s [=service worker registration/has + shownotification() been successfully invoked|has `showNotification()` been + successfully invoked=].

    8. - Otherwise, set |notificationResult| to |registration|'s [=service worker - registration/has shownotification() been successfully invoked|has - `showNotification()` been successfully invoked=]. + Set |appBadgeResult| to true if {{NavigatorBadge/setAppBadge()}} has been + invoked; otherwise false.

  • - Wait for |notificationResult| to be non-null. + Wait for |notificationResult| and |appBadgeResult| to be non-null.

  • @@ -1854,12 +1917,12 @@

  • - [=/Assert=]: |notificationResult| is a [=/boolean=]. + [=/Assert=]: |notificationResult| and |appBadgeResult| are [=/booleans=].

  • - Return (|notificationResult|). + Return (|notificationResult|, |appBadgeResult|).