Update popup preview frame message handlers
This commit is contained in:
parent
5588643988
commit
7837e9f0e3
@ -106,12 +106,11 @@ class SettingsPopupPreview {
|
|||||||
|
|
||||||
onMessage(e) {
|
onMessage(e) {
|
||||||
const {action, params} = e.data;
|
const {action, params} = e.data;
|
||||||
const handlers = SettingsPopupPreview.messageHandlers;
|
const handler = SettingsPopupPreview._messageHandlers.get(action);
|
||||||
if (hasOwn(handlers, action)) {
|
if (typeof handler !== 'function') { return; }
|
||||||
const handler = handlers[action];
|
|
||||||
handler(this, params);
|
handler(this, params);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
onThemeDarkCheckboxChanged(node) {
|
onThemeDarkCheckboxChanged(node) {
|
||||||
document.documentElement.classList.toggle('dark', node.checked);
|
document.documentElement.classList.toggle('dark', node.checked);
|
||||||
@ -176,11 +175,11 @@ class SettingsPopupPreview {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsPopupPreview.messageHandlers = {
|
SettingsPopupPreview._messageHandlers = new Map([
|
||||||
setText: (self, {text}) => self.setText(text),
|
['setText', (self, {text}) => self.setText(text)],
|
||||||
setCustomCss: (self, {css}) => self.setCustomCss(css),
|
['setCustomCss', (self, {css}) => self.setCustomCss(css)],
|
||||||
setCustomOuterCss: (self, {css}) => self.setCustomOuterCss(css)
|
['setCustomOuterCss', (self, {css}) => self.setCustomOuterCss(css)]
|
||||||
};
|
]);
|
||||||
|
|
||||||
SettingsPopupPreview.instance = SettingsPopupPreview.create();
|
SettingsPopupPreview.instance = SettingsPopupPreview.create();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user