Skip to content

Commit

Permalink
refactor: message listener
Browse files Browse the repository at this point in the history
  • Loading branch information
jebibot committed Dec 20, 2024
1 parent 8b691e6 commit 2db0c53
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,9 @@ export default {
});
window.addEventListener("message", (e) => {
if (e.origin === "https://play.sooplive.co.kr") {
const idx = Array.prototype.findIndex.call(iframes, (f) => e.source === f.contentWindow);
switch (e.data.cmd) {
case "PonReady":
const idx = Array.prototype.findIndex.call(iframes, (f) => e.source === f.contentWindow);
if (init && hasExtension && idx === 0) {
init = false;
chat.src = chatSelect.value;
Expand All @@ -439,7 +439,7 @@ export default {
}, "https://play.sooplive.co.kr");
break;
case "PupdateBroadInfo":
setName(Array.prototype.findIndex.call(iframes, (f) => e.source === f.contentWindow), e.data.data.nick);
setName(idx, e.data.data.nick);
break;
case "showRefreshOverlay":
showRefreshOverlay();
Expand Down

0 comments on commit 2db0c53

Please sign in to comment.