fix: push settings val to listener
This commit is contained in:
parent
025cd555e9
commit
0dbc726f64
1 changed files with 2 additions and 4 deletions
|
@ -265,9 +265,7 @@ export default abstract class SettingHelper {
|
|||
* @param oldValue The old value
|
||||
*/
|
||||
private static notifyListeners(key: SettingString, newValue: any, oldValue: any): void {
|
||||
if (!this.listeners.has(key)) return;
|
||||
|
||||
const callbacks = this.listeners.get(key)!;
|
||||
const callbacks = this.listeners.get(key) ?? [];
|
||||
for (const callback of callbacks) {
|
||||
try {
|
||||
callback(newValue, oldValue);
|
||||
|
@ -276,7 +274,7 @@ export default abstract class SettingHelper {
|
|||
}
|
||||
}
|
||||
|
||||
const topicCallbacks = this.topicListeners.get(key.split(".")[0] as SettingTopic)!;
|
||||
const topicCallbacks = this.topicListeners.get(key.split(".")[0] as SettingTopic) ?? [];
|
||||
for (const callback of topicCallbacks) {
|
||||
try {
|
||||
callback();
|
||||
|
|
Loading…
Add table
Reference in a new issue