Expand my Community achievements bar.

Event rule based window message?

Avatar

Level 4

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

Avatar

Level 10

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

 

Avatar

Level 4
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()})