2016-08-07 123 views
0

從服務人員調用self.registration.getNotifications({ tag: tag })時,返回的數組始終包含已被替換的舊通知。例如:從通知列表中刪除持久通知(通知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 ] 

回答

0

即使通知API規範是明確了steps for replacing a notification

  1. ...
  2. 替換舊與新,在同樣的位置,在通知的列表。
  3. ...

實現保持老的通知列表,直到.close()明確從代碼中調用或者直到用戶點擊該通知本身的[x]按鈕,隱含運行.close()