Screen visibility change event

For some reason, I want to listen to an Event when a Screen is hidden or visible. For example, open a new page in a new tab. How should Ido?


could you clarify in more details what you try to achieve? For now, you can check whether open screen or not like this:

private Screens screens;

protected boolean isMyScreenOpened() {
    Class<OrderBrowse> myScreenClass = OrderBrowse.class;

    Optional<Screens.WindowStack> windowStack = screens.getOpenedScreens().getWorkAreaStacks().stream()
            .filter(ws -> ws.getBreadcrumbs().stream().anyMatch(screen ->
                    screen.getClass() == myScreenClass)) // also may be check screen id, see Screen#isSameScreen
    return windowStack.isPresent();

I’ve got another way instead of listening to an event, I use a timer check Screens.WindowStack isSelected every second