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

add track prop to track changes in system preference #16

Merged
merged 2 commits into from
Oct 28, 2023

Conversation

ollema
Copy link
Collaborator

@ollema ollema commented Oct 28, 2023

when track is set to true (default), mode-watcher will add an event listener to the media query event and update the mode whenever prefers-color-scheme is changed.

track being set to true could be considered as a breaking change? I view it more as a bug fix. therefore I marked it is patch. what do you think @huntabyte?

will close #13

@changeset-bot
Copy link

changeset-bot bot commented Oct 28, 2023

🦋 Changeset detected

Latest commit: 2bb9d31

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
mode-watcher Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ollema
Copy link
Collaborator Author

ollema commented Oct 28, 2023

also, would be cool to add some tests for this but I could not figure out how to change prefers-color-scheme programatically. found (and tried) vitest-dev/vitest#821 but was not sure how to apply that method.

maybe emitting MediaQueryListEvent events somehow could work? but that's not something I am familiar with

@huntabyte
Copy link
Member

Yeah, I'll look into emitting the event to get it tested! Thanks again for your efforts here!

@huntabyte huntabyte merged commit 8c93706 into svecosystem:main Oct 28, 2023
3 checks passed
@huntabyte huntabyte changed the title add track prop which allows <ModeWatcher> to track changes in system preference add track prop to track changes in system preference Oct 28, 2023
@ollema
Copy link
Collaborator Author

ollema commented Oct 29, 2023

FYI @shyakadavis this is released now! let me know if you run into any issues

@ollema ollema deleted the track-changes branch November 8, 2023 20:43
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

Successfully merging this pull request may close these issues.

feature request: track changes in system preferences when user preference is not set
2 participants