Skip to content

Commit

Permalink
using post to send msg
Browse files Browse the repository at this point in the history
  • Loading branch information
SridharaQweebi committed Dec 20, 2024
1 parent 6dc1eae commit bbe2aa6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sim/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ namespace pxsim.unity {

//% blockId=helloUnity block="helloUnity"
export function helloUnity(){
window.postMessage("SendMsg", `SEND_MIXPANEL_EVENT:BtnClickBrowserVideoPlayerClose:VideoId:xx:Timestamp:12`)
const parent = window.parent as Record<string, any>
if (parent && typeof parent.sendMessage === "function") {
// Call the sendMessage function in the parent window
console.log("MakeCode: calling parent function..");
window.parent.postMessage("SendMsg", "")
parent.sendMessage(`SEND_MIXPANEL_EVENT:BtnClickBrowserVideoPlayerClose:VideoId:xx:Timestamp:12`)
}
else
Expand Down

0 comments on commit bbe2aa6

Please sign in to comment.