Event Listeners
์๊ฐ
์ด๋ฆ
์ค๋ช
๐ API ์ค๋ช
๋ฐ ์์
onMessage
์ด๋ฆ
ํ์
์ค๋ช
๋ถ๋ก
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
// ํ๋ ์ด์ด๊ฐ ์
์ฅํ ๋ ๋์ํ๋ ํจ์
App.onJoinPlayer.Add(function (player) {
player.tag = {
widget: null,
};
player.tag.widget = player.showWidget("sample.html.html", "top", 600, 500);
player.tag.widget.onMessage.Add(function (player, msg) {
// ์์ ฏ์์ App์ผ๋ก 'type: close'๋ผ๋ ๋ฉ์์ง๋ฅผ ๋ณด๋ด๋ฉด ์์ ฏ์ ํ๊ดดํจ
if (msg.type == "close") {
player.showCenterLabel("์์ ฏ์ด ๋ซํ์ต๋๋ค.");
player.tag.widget.destroy();
player.tag.widget = null;
}
});
});<i onclick="closeWidget()" class="fa-solid fa-xmark"></i>
<script type="text/javascript">
// x ๋ฒํผ์ ๋๋ฅด๋ฉด ํธ์ถ๋๋ ํจ์
function closeWidget() {
// App์ผ๋ก ๋ฉ์์ง๋ฅผ ๋ณด๋.
window.parent.postMessage(
{
type: "close",
},
"*"
);
}
</script>