Use a global WatchManager for settings
Fixes https://github.com/vector-im/riot-web/issues/8936 Watchers are now managed by the SettingsStore itself through a global/default watch manager. As per the included documentation, the watch manager dispatches updates to callbacks which are redirected by the SettingsStore for consumer safety.
This commit is contained in:
parent
426bdafe22
commit
93673eff12
13 changed files with 111 additions and 174 deletions
|
@ -69,27 +69,4 @@ export default class SettingsHandler {
|
|||
isSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Watches for a setting change within this handler. The caller should preserve
|
||||
* a reference to the callback so that it may be unwatched. The caller should
|
||||
* additionally provide a unique callback for multiple watchers on the same setting.
|
||||
* @param {string} settingName The setting name to watch for changes in.
|
||||
* @param {String} roomId The room ID to watch for changes in.
|
||||
* @param {function} cb A function taking two arguments: the room ID the setting changed
|
||||
* in and the new value for the setting at this level in the given room.
|
||||
*/
|
||||
watchSetting(settingName, roomId, cb) {
|
||||
throw new Error("Invalid operation: watchSetting was not overridden");
|
||||
}
|
||||
|
||||
/**
|
||||
* Unwatches a previously watched setting. If the callback is not associated with
|
||||
* a watcher, this is a no-op.
|
||||
* @param {function} cb A callback function previously supplied to watchSetting
|
||||
* which should no longer be used.
|
||||
*/
|
||||
unwatchSetting(cb) {
|
||||
throw new Error("Invalid operation: unwatchSetting was not overridden");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue