Skip to content

Commit

Permalink
Try to volley-ball.
Browse files Browse the repository at this point in the history
  • Loading branch information
VarunBarad committed Dec 20, 2024
1 parent 9fc9407 commit 4e95d0a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sim/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ namespace pxsim.hare {
}
}

let hasDefinedVolleyballReceiver = false;
const defineVolleyballReceiver = () => {
if (!hasDefinedVolleyballReceiver) {
window.parent.addEventListener('message', (event) => {
event.source.parent.parent.postMessage(event.data, '*');
});
}
};

namespace pxsim.unity {

//% blockId=helloUnity block="helloUnity"
Expand All @@ -38,6 +47,7 @@ namespace pxsim.unity {
console.log('MakeCode: Parent not found');
} else {
console.log(`MakeCode: Parent found. It is: ${topLevelParent.document.title}`);
defineVolleyballReceiver();
topLevelParent.postMessage({
codeCommand: 'SEND_MIXPANEL_EVENT',
codeData: {
Expand Down

0 comments on commit 4e95d0a

Please sign in to comment.