Javascript from HTML iframe

I have a HTML iframe for a form. According to the API of the form service I’m using:

Because widgets output HTML directly on to a page, you can customize widgets further with javascript. For example, you can use javascript to change the text of our submit buttons, or do something different after a successful form submission.

and

can_embed_submitted is fired when any widget's form is successfully submitted

How can I make it so that when my HTML iframe fires can_embed_submitted, corvid does an action (eg collapse a section)? Is it possible to receive a message from the embedded widget in this way?

Thank you