aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-02-26 20:07:14 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-02-26 20:07:14 -0500
commit78dc501d02830244f898d5752c3cf2bc9841524c (patch)
treef0255414d710d5379cb9adf30ad4ea12dfb8a3dc /ext
parent03ba1b633e2230435f6baeeaa4b6009de2932452 (diff)
Move event handler definitions
Diffstat (limited to 'ext')
-rw-r--r--ext/bg/js/settings/popup-preview-frame.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/ext/bg/js/settings/popup-preview-frame.js b/ext/bg/js/settings/popup-preview-frame.js
index aa2b6100..d0336b5e 100644
--- a/ext/bg/js/settings/popup-preview-frame.js
+++ b/ext/bg/js/settings/popup-preview-frame.js
@@ -28,6 +28,12 @@ class SettingsPopupPreview {
this.themeChangeTimeout = null;
this.textSource = null;
this._targetOrigin = chrome.runtime.getURL('/').replace(/\/$/, '');
+
+ this._windowMessageHandlers = new Map([
+ ['setText', ({text}) => this.setText(text)],
+ ['setCustomCss', ({css}) => this.setCustomCss(css)],
+ ['setCustomOuterCss', ({css}) => this.setCustomOuterCss(css)]
+ ]);
}
static create() {
@@ -101,10 +107,10 @@ class SettingsPopupPreview {
if (e.origin !== this._targetOrigin) { return; }
const {action, params} = e.data;
- const handler = SettingsPopupPreview._messageHandlers.get(action);
+ const handler = this._windowMessageHandlers.get(action);
if (typeof handler !== 'function') { return; }
- handler(this, params);
+ handler(params);
}
onThemeDarkCheckboxChanged(node) {
@@ -171,12 +177,6 @@ class SettingsPopupPreview {
}
}
-SettingsPopupPreview._messageHandlers = new Map([
- ['setText', (self, {text}) => self.setText(text)],
- ['setCustomCss', (self, {css}) => self.setCustomCss(css)],
- ['setCustomOuterCss', (self, {css}) => self.setCustomOuterCss(css)]
-]);
-
SettingsPopupPreview.instance = SettingsPopupPreview.create();