Skip to content

Changes to notifications module required by webext-sdk

Background

Users of the webext-sdk don't have direct access to the prefs module, but they do have access to the notifications module. So some changes to the notifications module are required in order to control the notifications mechanism without access to the prefs module.

What to change

  • Add notifications.numBlocked that can be set instead of Prefs.blocked_total.
    • Still consider Prefs.blocked_total (and Prefs.show_statsinpopup) if available for backwards compatibility.
  • Add notifications.getDownloadCount() (wrapping Prefs.notificationdata.downloadCount).
  • Add notifications.getIgnoredCategories() (wrapping Prefs.notifications_ignoredcategories).
  • Derive the Notifications class from EventEmitter and implement the following events:
    • downloaded: Emitted when a new notification data download was processed and the download count has been updated.
    • ignored-category-added: Emitted when an ignored category was added.
    • ignored-category-removed: Emitted when an ignored category was removed.