Expand documentation on resize event for client preferences

Bug: T375559
Change-Id: I0326de423c18eeeb6bce3cef2dc72fe248695b18
This commit is contained in:
Jon Robson 2024-10-24 09:55:26 -07:00 committed by Jdlrobson
parent a9a2b617f5
commit 01e50fbda8

View file

@ -70,6 +70,9 @@ function toggleDocClassAndSave( featureName, value, config, userPreferences ) {
document.documentElement.classList.add( `${ featureName }-clientpref-${ value }` );
// Client preferences often change the layout of the page significantly, so emit
// a window resize event for other apps that need to update (T374092).
// This is used by VisualEditor. If you plan to use this event for any other
// purpose please let web team know so we can understand the use case better
// (T375559 for more details).
window.dispatchEvent( new Event( 'resize' ) );
// Ideally this should be taken care of via a single core helper function.
mw.util.debounce( () => {