diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-02-26 21:19:22 -0500 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-02-26 21:19:22 -0500 |
commit | fdfc2d33bbcd32f2984e74bd58a518fcc50705d2 (patch) | |
tree | 8351a0a0ff46acf9852f1a374bb56817786ddab8 /ext/bg/js | |
parent | 2d109c3e56231fc84dd225977bc4ef78eac9ed4d (diff) |
Simplify event to use bind
Diffstat (limited to 'ext/bg/js')
-rw-r--r-- | ext/bg/js/settings/popup-preview-frame.js | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/ext/bg/js/settings/popup-preview-frame.js b/ext/bg/js/settings/popup-preview-frame.js index 4c086bcd..1ceac177 100644 --- a/ext/bg/js/settings/popup-preview-frame.js +++ b/ext/bg/js/settings/popup-preview-frame.js @@ -46,10 +46,7 @@ class SettingsPopupPreview { // Setup events window.addEventListener('message', this.onMessage.bind(this), false); - const themeDarkCheckbox = document.querySelector('#theme-dark-checkbox'); - if (themeDarkCheckbox !== null) { - themeDarkCheckbox.addEventListener('change', () => this.onThemeDarkCheckboxChanged(themeDarkCheckbox), false); - } + document.querySelector('#theme-dark-checkbox').addEventListener('change', this.onThemeDarkCheckboxChanged.bind(this), false); // Overwrite API functions window.apiOptionsGet = this.apiOptionsGet.bind(this); @@ -113,8 +110,8 @@ class SettingsPopupPreview { handler(params); } - onThemeDarkCheckboxChanged(node) { - document.documentElement.classList.toggle('dark', node.checked); + onThemeDarkCheckboxChanged(e) { + document.documentElement.classList.toggle('dark', e.target.checked); if (this.themeChangeTimeout !== null) { clearTimeout(this.themeChangeTimeout); } |