This is a glaring issue when we look at our test suite and see the common before hooks we've written to clean up open windows/etc.
We have no means of telling if a Window is closed or open. So instead we fire off a 3-second setTimeout fallback to handle the "isClosed" case, and then hang an event listener for the close event and try to close the window. So in the case where the test never opened the window (or already closed it), we basically do nothing for 3 seconds and assume since the close event never fired that it must have been closed.
We have Ti.UI.View.visible which should tell us if a view is hidden or visible.
Ti.UI.Window.closed - boolean, true or false
- tells us if the window is closed (do we need opened equivalent? I assume they'd just be inversions of one another)
- Potential alternates? isClosed, closed, opened, isOpened (properties versus methods?)
- Note that JavaFX uses showing as a roughly equivalent API here: https://openjfx.io/javadoc/13/javafx.graphics/javafx/stage/Window.html
- Android equivalent may be isActive? https://developer.android.com/reference/android/view/Window.html#isActive()
Ti.UI.View.focused - boolean, true or false
- Potential alternates? isFocused, hasFocus (properties versus methods?)