Is there a way to get the close event of a lightning component that is used as a quick action?

I have a component with


and I use


to close it on a button click.

But I also use

window.addEventListener('message', function(event) {

because I'm displaying a Visualforce page in an iframe and they communicate with postMessages


let vfOrigin = 'https://' + cmp.get('v.vfHost');
let vfWindow = cmp.find('vfFrame').getElement().contentWindow;
vfWindow.postMessage(message, vfOrigin);

vf page

parent.postMessage(msg, lexOrigin);

I then use


to stop listening on the event.

My problem now is, that if I close the quick action component with the default X button on the top right of the modal, I cannot remove the listener and if something else happens on the page that fires the event, my code gets executed.

So ideally I want to remove the event listener onclose of the quick action

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.