2016-08-07 187 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()