diff --git a/sim/api.ts b/sim/api.ts index 8ae2e2ee..76b4b8db 100644 --- a/sim/api.ts +++ b/sim/api.ts @@ -28,9 +28,11 @@ namespace pxsim.hare { namespace pxsim.unity { export function logHello(){ - window.parent.sendMessage( - `SEND_MIXPANEL_EVENT:BtnClickBrowserVideoPlayerClose:VideoId:xx:Timestamp:12` - ); + if (window.parent && typeof window.parent['sendMessage'] === "function") { + window.parent['sendMessage'](`SEND_MIXPANEL_EVENT:BtnClickBrowserVideoPlayerClose:VideoId:xx:Timestamp:12`) + } else { + console.error("Parent function is not available."); + } } }