aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/yomichan.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-09-11 12:29:18 -0700
committerAlex Yatskov <alex@foosoft.net>2016-09-11 12:29:18 -0700
commitd5ea03171ea997d6734e6d31197c7f233fff7084 (patch)
treef10dbfbc9868f5b9aaae2cefb0bbbcf3a56e4514 /ext/bg/js/yomichan.js
parent1ac14cd633b3a99a3dd8ec8d0ec29158077b3798 (diff)
Working with IndexDb
Diffstat (limited to 'ext/bg/js/yomichan.js')
-rw-r--r--ext/bg/js/yomichan.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/ext/bg/js/yomichan.js b/ext/bg/js/yomichan.js
index 557f8780..11f348bf 100644
--- a/ext/bg/js/yomichan.js
+++ b/ext/bg/js/yomichan.js
@@ -41,10 +41,10 @@ class Yomichan {
chrome.runtime.onInstalled.addListener(this.onInstalled.bind(this));
chrome.runtime.onMessage.addListener(this.onMessage.bind(this));
chrome.browserAction.onClicked.addListener(this.onBrowserAction.bind(this));
- chrome.tabs.onCreated.addListener((tab) => this.onTabReady(tab.id));
+ chrome.tabs.onCreated.addListener(tab => this.onTabReady(tab.id));
chrome.tabs.onUpdated.addListener(this.onTabReady.bind(this));
- loadOptions((opts) => {
+ loadOptions(opts => {
this.setOptions(opts);
if (this.options.activateOnStartup) {
this.setState('loading');
@@ -118,7 +118,7 @@ class Yomichan {
}
tabInvokeAll(action, params) {
- chrome.tabs.query({}, (tabs) => {
+ chrome.tabs.query({}, tabs => {
for (const tab of tabs) {
this.tabInvoke(tab.id, action, params);
}
@@ -133,7 +133,7 @@ class Yomichan {
if (this.ankiConnectVer === this.getApiVersion()) {
this.ankiInvoke(action, params, pool, callback);
} else {
- this.api_getVersion({callback: (version) => {
+ this.api_getVersion({callback: version => {
if (version === this.getApiVersion()) {
this.ankiConnectVer = version;
this.ankiInvoke(action, params, pool, callback);
@@ -209,7 +209,7 @@ class Yomichan {
break;
case 'tags':
if (definition.tags) {
- value = definition.tags.map((t) => t.name);
+ value = definition.tags.map(t => t.name);
}
break;
}
@@ -244,7 +244,7 @@ class Yomichan {
};
for (const name in fields) {
- if (fields[name].indexOf('{audio}') !== -1) {
+ if (fields[name].includes('{audio}')) {
audio.fields.push(name);
}
}
@@ -274,7 +274,7 @@ class Yomichan {
}
}
- this.ankiInvokeSafe('canAddNotes', {notes}, 'notes', (results) => {
+ this.ankiInvokeSafe('canAddNotes', {notes}, 'notes', results => {
const states = [];
if (results !== null) {
@@ -293,11 +293,11 @@ class Yomichan {
}
api_findKanji({text, callback}) {
- callback(this.translator.findKanji(text));
+ this.translator.findKanji(text).then(result => callback(result));
}
api_findTerm({text, callback}) {
- this.translator.findTerm(text).then((result) => callback(result));
+ this.translator.findTerm(text).then(result => callback(result));
}
api_getDeckNames({callback}) {