From 11f25cccb909adc7e8b5569f8e5e20c482234860 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Fri, 6 Mar 2015 13:28:43 +0100 Subject: [PATCH] Rename get to getNotifications and place it on ServiceWorkerRegistration instances. Fixes https://github.com/whatwg/notifications/issues/37 & https://github.com/slightlyoff/ServiceWorker/issues/504 --- Overview.html | 94 ++++++++++++++++++++++------------------------- Overview.src.html | 92 ++++++++++++++++++++++------------------------ 2 files changed, 87 insertions(+), 99 deletions(-) diff --git a/Overview.html b/Overview.html index 737f673..8105227 100644 --- a/Overview.html +++ b/Overview.html @@ -7,7 +7,7 @@

Notifications API

-

Living Standard — Last Updated 27 February 2015

+

Living Standard — Last Updated 6 March 2015

Participate:
@@ -831,16 +831,13 @@

5.5.3 6 Service worker API

-
partial interface Notification {
-  [Exposed=ServiceWorker] static Promise<sequence<Notification>> get(optional GetNotificationOptions filter);
-};
-
-dictionary GetNotificationOptions {
+
dictionary GetNotificationsOptions {
   DOMString tag = "";
 };
 
 partial interface ServiceWorkerRegistration {
   Promise<void> showNotification(DOMString title, optional NotificationOptions options);
+  Promise<sequence<Notification>> getNotifications(optional GetNotificationsOptions filter);
 };
 
 [Constructor(DOMString type, optional NotificationEventInit eventInitDict),
@@ -857,50 +854,6 @@ 

6 Service worker API

attribute EventHandler onnotificationclick; };
-

The static -get(filter) method, -when invoked, must run these steps: - -

    -
  1. Let promise be a new promise. - -

  2. -

    Run these substeps in parallel: - -

      -
    1. Let tag be filter's tag. - -

    2. Let notifications be a list of all - notifications in the - list of notifications whose - origin is the - entry settings object's - origin, whose - service worker registration is - XXX, - and whose tag, if tag is not the empty string, is - tag. - -

    3. Let objects be an empty JavaScript array. - -

    4. For each notification in - notifications, in creation order, create a new - Notification object representing - notification and push that object to - objects. - -

    5. Resolve promise with objects. -

    - -
  3. Return promise. -

- -

This method returns zero or more new Notification objects which -might represent the same underlying notification -of Notification objects already in existence. - -


-

The showNotification(title, options) method, when invoked, must return these steps: @@ -939,6 +892,47 @@

6 Service worker API

  • Return promise. +

    The +getNotifications(filter) +method, when invoked, must run these steps: + +

      +
    1. Let promise be a new promise. + +

    2. +

      Run these substeps in parallel: + +

        +
      1. Let tag be filter's tag. + +

      2. Let notifications be a list of all + notifications in the + list of notifications whose + origin is the + entry settings object's + origin, whose + service worker registration + is the context object, and whose tag, if + tag is not the empty string, is tag. + +

      3. Let objects be an empty JavaScript array. + +

      4. For each notification in + notifications, in creation order, create a new + Notification object representing + notification and push that object to + objects. + +

      5. Resolve promise with objects. +

      + +
    3. Return promise. +

    + +

    This method returns zero or more new Notification objects which +might represent the same underlying notification +of Notification objects already in existence. +


    To diff --git a/Overview.src.html b/Overview.src.html index 734540f..29364d9 100644 --- a/Overview.src.html +++ b/Overview.src.html @@ -801,16 +801,13 @@

    Using the tag member for a single instance

    Service worker API

    -
    partial interface Notification {
    -  [Exposed=ServiceWorker] static Promise<sequence<Notification>> get(optional GetNotificationOptions filter);
    -};
    -
    -dictionary GetNotificationOptions {
    +
    dictionary GetNotificationsOptions {
       DOMString tag = "";
     };
     
     partial interface ServiceWorkerRegistration {
       Promise<void> showNotification(DOMString title, optional NotificationOptions options);
    +  Promise<sequence<Notification>> getNotifications(optional GetNotificationsOptions filter);
     };
     
     [Constructor(DOMString type, optional NotificationEventInit eventInitDict),
    @@ -827,50 +824,6 @@ 

    Service worker API

    attribute EventHandler onnotificationclick; };
    -

    The static -get(filter) method, -when invoked, must run these steps: - -

      -
    1. Let promise be a new promise. - -

    2. -

      Run these substeps in parallel: - -

        -
      1. Let tag be filter's tag. - -

      2. Let notifications be a list of all - notifications in the - list of notifications whose - origin is the - entry settings object's - origin, whose - service worker registration is - XXX, - and whose tag, if tag is not the empty string, is - tag. - -

      3. Let objects be an empty JavaScript array. - -

      4. For each notification in - notifications, in creation order, create a new - Notification object representing - notification and push that object to - objects. - -

      5. Resolve promise with objects. -

      - -
    3. Return promise. -

    - -

    This method returns zero or more new Notification objects which -might represent the same underlying notification -of Notification objects already in existence. - -


    -

    The showNotification(title, options) method, when invoked, must return these steps: @@ -909,6 +862,47 @@

    Service worker API

  • Return promise. +

    The +getNotifications(filter) +method, when invoked, must run these steps: + +

      +
    1. Let promise be a new promise. + +

    2. +

      Run these substeps in parallel: + +

        +
      1. Let tag be filter's tag. + +

      2. Let notifications be a list of all + notifications in the + list of notifications whose + origin is the + entry settings object's + origin, whose + service worker registration + is the context object, and whose tag, if + tag is not the empty string, is tag. + +

      3. Let objects be an empty JavaScript array. + +

      4. For each notification in + notifications, in creation order, create a new + Notification object representing + notification and push that object to + objects. + +

      5. Resolve promise with objects. +

      + +
    3. Return promise. +

    + +

    This method returns zero or more new Notification objects which +might represent the same underlying notification +of Notification objects already in existence. +


    To