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

how to not call visibility if i made fullscreen #49

Open
novaknole opened this issue Apr 21, 2020 · 5 comments
Open

how to not call visibility if i made fullscreen #49

novaknole opened this issue Apr 21, 2020 · 5 comments

Comments

@novaknole
Copy link

So in my app, I have games and when I click play , what I do is call fullscreen code which starts the game in fullscreen mode.

Somewhere in my app, I have this piece of code:

this.visibility = Visibility.change((event, state) => {
                            switch (state) {
                                case 'visible':
                                    break;
                                case 'hidden':
                                    console.log("coming here ? ");
                                    break;
                            }
                        });

Now, this works fine for all cases except fullscreen. The thing I want is when fullscreen gets activated, I don't want it to call console.log("coming here ?"). I don't want it to do anything. Is this possible?

@ai
Copy link
Owner

ai commented Apr 21, 2020

You do not need Visibility.js nowadays. Use standard API without extra library wrapper.

@novaknole
Copy link
Author

novaknole commented Apr 21, 2020

  • So, what you're saying is i don't have to use this library at all to do what I want?
  • Which one is the standard API? any link?

@ai
Copy link
Owner

ai commented Apr 21, 2020

@novaknole
Copy link
Author

do you do anything in this wrapper so that it helps to work it out for more browser versions that it's currently supported on that link you linked?

@ai
Copy link
Owner

ai commented Apr 21, 2020

Most modern browsers support Page Visibility API out of the box https://caniuse.com/#feat=mdn-api_document_onvisibilitychange

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants