Skip to content

Commit 227a687

Browse files
Add postMessage listener for SGIWorld theme sync
Listen for 'sgiworld-theme' messages from parent window and apply the corresponding theme (dark/white). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2a942e2 commit 227a687

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

static/app.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,14 @@ const API = '';
9090
document.body.appendChild(sw);
9191
apply(saved);
9292
});
93+
94+
// Listen for theme changes from parent SGIWorld
95+
window.addEventListener('message', function (event) {
96+
if (event.data && event.data.type === 'sgiworld-theme') {
97+
var theme = event.data.theme === 'dark' ? 'dark' : 'white';
98+
apply(theme);
99+
}
100+
});
93101
})();
94102

95103
/* ── State ───────────────────────────────────────────────────────────── */

0 commit comments

Comments
 (0)