Open
Bug 2034690
Opened 4 months ago
Updated 4 months ago
Support Setting deps for AsyncSetting
Categories
(Firefox :: Settings UI, task, P3)
Firefox
Settings UI
Tracking
()
NEW
People
(Reporter: mstriemer, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [recomp])
Regular Setting objects support the deps property to be notified of changes to related settings. For the AsyncSetting this feature was never implemented. Bug 1972086 has the browser language settings and some custom implementations for managing deps in an AsyncSetting. This logic could be extracted to the base class, although probably not exactly as-is.
class MySetting extends AsyncSetting {
// Option 1: Explicitly getSetting with deps property
// Grabbing a Setting is pretty easy, although having the call here means
// the Setting must be defined already.
otherSetting = Preferences.getSetting("otherSetting");
// Registering the deps property could then set up the listeners
deps = [otherSetting];
// Option 2: Just the deps property with strings
// Avoids the timing issue of settings that depend on each other,
// but having cycles could lead to runaway event propagation.
// Probably not great for TS types, accessed with this.deps.otherSetting?
deps = ["otherSetting"];
// Option 3: Some helper function
// Less clear that you're getting a Setting, but avoids an import or duplicating into deps
otherSetting = this.setupDepSetting("otherSetting");
}
Updated•4 months ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•