2016-08-07 15 views
0

Beim Aufruf von self.registration.getNotifications({ tag: tag }) von einem Service Worker enthält das zurückgegebene Array immer alte Benachrichtigungen, die ersetzt wurden. Zum Beispiel:Persistente Benachrichtigung aus der Liste der Benachrichtigungen entfernen (Notifications API)

showNotification('A', { tag: 'abc' }) // Displays the first notification 
getNotifications({ tag: 'abc' }) // Returns [ NotificationA ] 
showNotification('B', { tag: 'abc' }) // Replaces the previous notification 
getNotifications({ tag: 'abc' }) // Returns [ NotificationB, NotificationA ] 
showNotification('C', { tag: 'abc' }) // Replaces the previous notification 
getNotifications({ tag: 'abc' }) // Returns [ NotificationC, NotificationB, NotificationA ] 

Antwort

0

Obwohl Mitteilung API-Spezifikationen klar sind über die steps for replacing a notification:

  1. ...
  2. alt Ersetzen durch neue, in der gleichen Position, in der Liste der Meldungen .
  3. ...

Die Implementierung bis zum .close() die alte Meldung in der Liste hält explizit vom Code aufgerufen oder bis der Benutzer selbst die [x] -Taste auf der Benachrichtigung klickt, implizit .close() läuft .

Verwandte Themen