Add iframe .postMessage theme switching (Sidecar)
Add iframe .postMessage
theme switching. The goal is to be able to switch the theme from Sidecar to match the outer site
Fix https://gitlab.com/gitlab-org/gitter/sidecar/issues/51
Downstream client usage to switch themes
index.html
<!doctype html><html><head><meta charset="utf-8"></head><body><iframe src="https://gitter.im/gitterHQ/api"></iframe><script>
const iwin = document.querySelector('iframe').contentWindow
onmessage = ({ source, data }) => {
if (source === iwin) console.log("got a message from gitter", data)
}
const type = 'theme',
const body = { name: 'dark' }
const message = { type, body }
iwin.postMessage(message)
</script></body></html>
Edited by Eric Eastwood