File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
src/components/global/Playground Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -244,6 +244,11 @@ export default function Playground({
244
244
const setAndSaveMode = ( mode : Mode ) => {
245
245
localStorage . setItem ( MODE_STORAGE_KEY , mode ) ;
246
246
setIonicMode ( mode ) ;
247
+
248
+ /**
249
+ * Tell other playgrounds on the page that the mode has
250
+ * updated, so they can sync up.
251
+ */
247
252
window . dispatchEvent (
248
253
new CustomEvent ( MODE_UPDATED_EVENT , {
249
254
detail : mode ,
@@ -265,6 +270,10 @@ export default function Playground({
265
270
*/
266
271
blockElementScrollPositionUntilNextRender ( tab ) ;
267
272
273
+ /**
274
+ * Tell other playgrounds on the page that the framework
275
+ * has updated, so they can sync up.
276
+ */
268
277
window . dispatchEvent (
269
278
new CustomEvent ( USAGE_TARGET_UPDATED_EVENT , {
270
279
detail : target ,
@@ -400,6 +409,10 @@ export default function Playground({
400
409
io . observe ( hostRef . current ! ) ;
401
410
} ) ;
402
411
412
+ /**
413
+ * Listen for any playground on the page to have its mode or framework
414
+ * updated so this playground can switch to the same setting.
415
+ */
403
416
useEffect ( ( ) => {
404
417
window . addEventListener ( MODE_UPDATED_EVENT , ( e : CustomEvent ) => {
405
418
const mode = e . detail ;
You can’t perform that action at this time.
0 commit comments