Opened 4 years ago

Closed 4 years ago

#3826 closed change (fixed)

Filter preference change events

Reported by: sebastian Assignee: sebastian
Priority: P3 Milestone: Adblock-Plus-1.12-for-Chrome-Opera-Safari
Module: Unknown Keywords:
Cc: greiner Blocked By: #3839
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29338534

Description (last modified by kzar)

Background

Some code currently responds to preference changes through Prefs.onChanged.addListener(), using always the same boilerplate to bail out unless a particular preference was changed. So it would be preferable if you could specify the preference when adding the callback which then only gets called for that preference.

Also, this is a good opportunity to align prefs.Prefs with messaging.Port (#3823), replacing Pref.onChanged.addListener/removeListener with Prefs.on/off.

What to change

  • Move the event emitter logic to a separate module.
  • Replace Prefs.onChanged with Prefs.on(pref, cb) and Prefs.off(pref, cb).
  • Adapt existing code.

Change History (6)

comment:1 Changed 4 years ago by sebastian

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:2 Changed 4 years ago by greiner

  • Cc greiner added

comment:3 Changed 4 years ago by kzar

  • Description modified (diff)

comment:4 Changed 4 years ago by sebastian

  • Blocked By 3839 added

comment:5 Changed 4 years ago by abpbot

A commit referencing this issue has landed:
https://hg.adblockplus.org/adblockpluschrome/rev/55a72b2e72ab

comment:6 Changed 4 years ago by sebastian

  • Milestone set to Adblock-Plus-for-Chrome-Opera-Safari-next
  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.