Last active
March 23, 2021 14:50
-
-
Save MarsiBarsi/118c6aedb0ea7c80cdd3ecfa08d61bfb to your computer and use it in GitHub Desktop.
rxjs pageVisibility$
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pageVisibility$ = fromEvent(documentRef, 'visibilitychange').pipe( | |
startWith(0), | |
map(() => documentRef.visibilityState !== 'hidden'), | |
distinctUntilChanged(), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment