Salesforce lwc lightning/modal dispatchEvent

Documentation - - modal - API 56 When I try to fire an event from the modal window to the parent window - completely according to the example from the documentation - I get an error -

Failed to execute 'dispatchEvent' on 'EventTarget': parameter 1 is not of type 'Event'.

Completely according to the example from the documentation

this.dispatchEvent(new CustomEvent('select', { detail: { id: 42 } })); 

The error occurs even at the moment the event is sent - not to mention the moment it is received

I'm waiting for an event but it doesn't happen

1 Answer

You have to enable Lightning Web Security Enabled in the org to get this working.

You can check this

I've checked it myself and it's working well.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like