When the onClose
event is called I need to tell if it happened as a result of a user clicking the X or outside and a close()
method.
If a close()
method was used I know it was a controlled close and I know verified that the data was saved first. If it was an uncontrolled close, I need to ask the user if they want the data saved.
I know I can do this with a somewhat convoluted process of setting and unsetting a temp state flag, but I am looking for something a bit more elegant or simple.