aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-09-11 20:35:53 -0700
committerAlex Yatskov <alex@foosoft.net>2016-09-11 20:35:53 -0700
commitf653195aed4fe1ce12b771cb1e5de06d9e6f0253 (patch)
tree4ee410542abea07a0d1e8dffefb97ff082f58a2a /ext/fg/js
parent8f776cf759c0572904afbed5fc168883e8d3324f (diff)
Cleanup
Diffstat (limited to 'ext/fg/js')
-rw-r--r--ext/fg/js/client.js26
1 files changed, 10 insertions, 16 deletions
diff --git a/ext/fg/js/client.js b/ext/fg/js/client.js
index 8f9fdc08..266e4b5a 100644
--- a/ext/fg/js/client.js
+++ b/ext/fg/js/client.js
@@ -183,25 +183,19 @@ class Client {
}
api_displayKanji(kanji) {
- let defs = [];
- let seq = -1;
-
bgFindKanji(kanji).then(definitions => {
definitions.forEach(definition => definition.url = window.location.href);
- defs = definitions;
- seq = ++this.sequence;
-
- return bgRenderText({definitions, root: this.fgRoot, options: this.options, sequence: seq}, 'kanji-list.html');
- }).then(content => {
- this.definitions = defs;
- this.popup.setContent(content, defs);
-
- return bgCanAddDefinitions(defs, ['kanji']);
- }).then(states => {
- if (states !== null) {
- states.forEach((state, index) => this.popup.sendMessage('setActionState', {index, state, sequence: seq}));
- }
+ const sequence = ++this.sequence;
+ return bgRenderText({definitions, sequence, root: this.fgRoot, options: this.options}, 'kanji-list.html').then(content => {
+ this.definitions = definitions;
+ this.popup.setContent(content, definitions);
+ return bgCanAddDefinitions(definitions, ['kanji']);
+ }).then(states => {
+ if (states !== null) {
+ states.forEach((state, index) => this.popup.sendMessage('setActionState', {index, state, sequence}));
+ }
+ });
});
}