Preferences: Fire synctopreference *after* updating preference (#4615)

And add a new beforesynctopreference event to replace the old behavior.
You almost always want the preference to be updated before acting on
the change.
This commit is contained in:
Abe Jellinek 2024-08-23 14:09:42 -04:00 committed by Dan Stillman
parent 9978fa73e1
commit 5e71fdf1cc

View file

@ -430,8 +430,9 @@ ${str}
else {
value = elem.value;
}
elem.dispatchEvent(new Event('synctopreference'));
elem.dispatchEvent(new Event('beforesynctopreference'));
Zotero.Prefs.set(preference, value, true);
elem.dispatchEvent(new Event('synctopreference'));
},
/**