Skip to content

Commit

Permalink
Extract element name as a constant
Browse files Browse the repository at this point in the history
  • Loading branch information
mahozad committed Mar 8, 2022
1 parent e961a65 commit 8c3082b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion theme-switch.js
Expand Up @@ -97,6 +97,7 @@
* - https://github.com/floating-ui/floating-ui
* */

const ELEMENT_NAME = "theme-switch";
const ICON_SIZE = 24 /* px */;
const ICON_COLOR = "#000";
const THEME_KEY = "theme";
Expand Down Expand Up @@ -281,7 +282,7 @@ function generateStyle() {
}

updateTheme();
window.customElements.define("theme-switch", ThemeSwitchElement);
window.customElements.define(ELEMENT_NAME, ThemeSwitchElement);
window
.matchMedia(COLOR_SCHEME_DARK)
.addEventListener("change", updateTheme);
Expand Down
12 changes: 6 additions & 6 deletions theme-switch.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8c3082b

Please sign in to comment.