summaryrefslogtreecommitdiff
path: root/ext/fg
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fg')
-rw-r--r--ext/fg/js/display-frame.js19
-rw-r--r--ext/fg/js/driver.js10
2 files changed, 15 insertions, 14 deletions
diff --git a/ext/fg/js/display-frame.js b/ext/fg/js/display-frame.js
index 41c2fb53..59032d0c 100644
--- a/ext/fg/js/display-frame.js
+++ b/ext/fg/js/display-frame.js
@@ -57,23 +57,24 @@ window.displayFrame = new class extends Display {
}
onMessage(e) {
- const handlers = new class {
- showTermDefs({definitions, options, context}) {
+ const handlers = {
+ showTermDefs: ({definitions, options, context}) => {
this.showTermDefs(definitions, options, context);
- }
+ },
- showKanjiDefs({definitions, options, context}) {
+ showKanjiDefs: ({definitions, options, context}) => {
this.showKanjiDefs(definitions, options, context);
- }
+ },
- showOrphaned() {
+ showOrphaned: () => {
this.showOrphaned();
}
};
- const {action, params} = e.originalEvent.data, method = handlers[action];
- if (typeof(method) === 'function') {
- method.call(this, params);
+ const {action, params} = e.originalEvent.data;
+ const handler = handlers[action];
+ if (handler) {
+ handler(params);
}
}
};
diff --git a/ext/fg/js/driver.js b/ext/fg/js/driver.js
index 036dc2d8..2324e6b2 100644
--- a/ext/fg/js/driver.js
+++ b/ext/fg/js/driver.js
@@ -116,8 +116,8 @@ window.driver = new class {
}
onBgMessage({action, params}, sender, callback) {
- const handlers = new class {
- optionsSet(options) {
+ const handlers = {
+ optionsSet: options => {
this.options = options;
if (!this.options.enable) {
this.searchClear();
@@ -125,9 +125,9 @@ window.driver = new class {
}
};
- const method = handlers[action];
- if (typeof(method) === 'function') {
- method.call(this, params);
+ const handler = handlers[action];
+ if (handler) {
+ handler(params);
}
callback();