Write custom JS logic that renders on closing a dialog
I'm writing a custom JS file for a custom component. I want that js to render when I click on 'done' on the component dialog. What should I mention in the js that specifies this requirement? The js logic is

To provide further details -
1. Need to put a validation on character count of description field (type = richtext)
2. Maxlength property did not work for richtext