Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Event rule based window message?

tim_funk
Level 2
Level 2

Is there an event configuration where my rule would trigger on the equivalent of window.addEventListener("message" ...) ? Then even more vexxing is can I then create rule conditions filtering on the values in event.origin and event.data? Based on what I see - I think the answer is no.

 

Use case is I have an iframe using postMessage to let the parent window know something happened.

 

I suspect I will need to create my own listener. Then let that listener do the appropriate filtering and validation and then based on the payload fire the appropriate direct calls.

2 Replies
Andrey_Osadchuk
Community Advisor
Community Advisor

You may want to use Custom Event to get the rule triggered.

 
tim_funk
Level 2
Level 2
I don't think Custom Event will work. The event is fired onto the window object. And the custom event rule seems to be element focuses. But I do see "Custom Code" in which case I could add my window.addEventListener("message". function(){if(checkPasses) trigger()})