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

IsIdle's detectVisibilityChanges default should be consistent with its docs #147

Open
derheld42 opened this issue Nov 27, 2024 · 0 comments
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Open to contributions from the community.

Comments

@derheld42
Copy link

Describe the bug

I think the default for IsIdle's detectVisibilityChanges is actually false, but the API docs indicate it's true. I could put out a pull request if you'd like.

Reproduction

const idle = new IsIdle({ timeout: 5000 });

watch(
	() => idle.current,
	(cur, prev) => {
		if (cur) {
			console.log('IDLE');
		}
		if (prev && cur == false) {
			console.log('No longer idle!');
		}
	},
);

Then switch to a different tab, wait 5 seconds, come back.. No "No longer idle" message seen, but should be IF we were detecting visibility changes as the docs say.

then change first line to this:
const idle = new IsIdle({ timeout: 5000, detectVisibilityChanges: true });

Then switch to a different tab, wait 5 seconds, come back.. "No longer idle" message seen. This is what I was expecting it do without specifying "detectVisibilityChanges: true"

Logs

No response

System Info

System:
    OS: Linux 6.8 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat)
    CPU: (16) x64 AMD Ryzen 9 PRO 7940HS w/ Radeon 780M Graphics
    Memory: 48.63 GB / 61.45 GB
    Container: Yes
    Shell: 5.2.21 - /bin/bash
  Binaries:
    Node: 20.17.0 - ~/.nvm/versions/node/v20.17.0/bin/node
    npm: 10.8.2 - ~/.nvm/versions/node/v20.17.0/bin/npm
  npmPackages:
    @sveltejs/kit: ^2.5.27 => 2.8.4 
    runed: ^0.15.4 => 0.15.4 
    svelte: ^5.0.0 => 5.2.8

Severity

annoyance

@huntabyte huntabyte added documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Open to contributions from the community. labels Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Open to contributions from the community.
Projects
None yet
Development

No branches or pull requests

2 participants