mirror of https://github.com/vector-im/riot-web
SettingsStore, use a counter instead of wall clock for watcher ids
parent
463bddb7e9
commit
a8f7e381eb
|
@ -113,6 +113,9 @@ export default class SettingsStore {
|
||||||
static _watchers = {}; // { callbackRef => { callbackFn } }
|
static _watchers = {}; // { callbackRef => { callbackFn } }
|
||||||
static _monitors = {}; // { settingName => { roomId => callbackRef } }
|
static _monitors = {}; // { settingName => { roomId => callbackRef } }
|
||||||
|
|
||||||
|
// Counter used for generation of watcher IDs
|
||||||
|
static _watcherCount = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Watches for changes in a particular setting. This is done without any local echo
|
* Watches for changes in a particular setting. This is done without any local echo
|
||||||
* wrapping and fires whenever a change is detected in a setting's value, at any level.
|
* wrapping and fires whenever a change is detected in a setting's value, at any level.
|
||||||
|
@ -138,7 +141,7 @@ export default class SettingsStore {
|
||||||
settingName = setting.invertedSettingName;
|
settingName = setting.invertedSettingName;
|
||||||
}
|
}
|
||||||
|
|
||||||
const watcherId = `${new Date().getTime()}_${settingName}_${roomId}`;
|
const watcherId = `${SettingsStore._watcherCount++}_${settingName}_${roomId}`;
|
||||||
|
|
||||||
const localizedCallback = (changedInRoomId, atLevel, newValAtLevel) => {
|
const localizedCallback = (changedInRoomId, atLevel, newValAtLevel) => {
|
||||||
const newValue = SettingsStore.getValue(originalSettingName);
|
const newValue = SettingsStore.getValue(originalSettingName);
|
||||||
|
|
Loading…
Reference in New Issue