Event before close or hide window

Need to add logic/function on event when window is hide or close. If function return false then don’t need to close/hide. What event could I using?

	modal: true,
	close: true,
		onHide: function(){return false}

this code not working: window is close on this event

Unfortunately, the window does not have such an event.
If we are talking about a window, then in order to close/hide it, you need to press a button or icon. That is, you can redefine the reaction of a button / icon when it is clicked.
Example: Code Snippet

If this is not what you need, please provide us with more details on this case.

you can try to rewrite window’s hide/close logic