Skip to content

Commit

Permalink
Convert a global variable to class static field
Browse files Browse the repository at this point in the history
  • Loading branch information
mahozad committed Mar 8, 2022
1 parent 0e6a7af commit 6d8bc9c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions theme-switch.js
Expand Up @@ -112,12 +112,11 @@ const ICON_INITIAL_STATE_FOR_AUTO = [10, 0, 33, 0];
const ICON_INITIAL_STATE_FOR_DARK = [10, 0, 20, 1];
const ICON_INITIAL_STATE_FOR_LIGHT = [5, 1, 33, 1];

let counter = 0; // See https://stackoverflow.com/a/43116254/8583692

class ThemeSwitchElement extends HTMLElement {
shadowRoot;
themeToggleEvent;
identifier = counter++;
static counter = 0; // See https://stackoverflow.com/a/43116254/8583692
identifier = ThemeSwitchElement.counter++;

constructor() {
super();
Expand Down
6 changes: 3 additions & 3 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 6d8bc9c

Please sign in to comment.