Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docs: onVisibilityChange doesn’t react to switching windows #125

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Browser/Events.elm
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ onResize func =


{-| Subscribe to any visibility changes, like if the user switches to a
different tab or window. When the user looks away, you may want to:
different tab or minimizes the window. When the user looks away, you may want to:

- Pause a timer.
- Pause an animation.
Expand All @@ -218,6 +218,11 @@ different tab or window. When the user looks away, you may want to:
- Stop polling a server for new information.
- Stop waiting for an [`onKeyUp`](#onKeyUp) event.

**Note:** Switching to a different window on a desktop browser will likely not fire the event,
since browsers don’t know if the window is actually obscured or not. See the docs on the
[Page Visibility API](https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API).


-}
onVisibilityChange : (Visibility -> msg) -> Sub msg
onVisibilityChange func =
Expand Down