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 events for config value changes #144

Merged
merged 3 commits into from
Mar 29, 2024

Conversation

throwaway96
Copy link
Member

Adds the ability to listen for changes to a config value with configAddChangeListener(key, callback) (plus of course configRemoveChangeListener()).

Using this functionality, the options panel UI now updates automatically when settings are modified with configWrite().

I'm not sure using DocumentFragments is the best way (or even a good way) to do this. It does seem to work, though.

@throwaway96 throwaway96 force-pushed the config-events-20240328 branch from d9c7207 to 0d846a9 Compare March 29, 2024 03:54
@throwaway96 throwaway96 added the enhancement New feature or request label Mar 29, 2024
All other functions exported by config.js have a "config" prefix.

There is also currently no need to export configOptions.
@throwaway96 throwaway96 force-pushed the config-events-20240328 branch from 0d846a9 to a8ed86b Compare March 29, 2024 04:58
@fire332
Copy link
Collaborator

fire332 commented Mar 29, 2024

Why are you using DocumentFragment and not EventTarget directly? DocumentFragment inherits from EventTarget so it doesn't make sense to use the former unless you need methods from it.

From MDN:
image

@throwaway96
Copy link
Member Author

The EventTarget constructor isn't supported in old Chromium. I don't know if there are polyfills for that, but to be honest I don't really trust them anyway.

@throwaway96 throwaway96 merged commit 9a3fff1 into webosbrew:main Mar 29, 2024
1 check passed
throwaway96 added a commit that referenced this pull request Mar 29, 2024
Also add a newline I forgot last time.
fire332 pushed a commit to fire332/youtube-webos that referenced this pull request Mar 31, 2024
Also add a newline I forgot last time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants