aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-05-02 21:50:36 -0700
committerAlex Yatskov <alex@foosoft.net>2016-05-02 21:50:36 -0700
commit0ed936438c655c300a078d227f36af4ecf95824e (patch)
treef2e5600075aa3f090ea616011b2303f1e947ec0c /ext/bg/js
parent57a426f4f277d1e5dac98b0427efcb43f5ab20e4 (diff)
WIP
Diffstat (limited to 'ext/bg/js')
-rw-r--r--ext/bg/js/yomichan.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/bg/js/yomichan.js b/ext/bg/js/yomichan.js
index 32c12407..207ab4d5 100644
--- a/ext/bg/js/yomichan.js
+++ b/ext/bg/js/yomichan.js
@@ -124,7 +124,7 @@ class Yomichan {
callAnkiApi(action, data, callback) {
if (this.options.enableAnkiConnect) {
const xhr = new XMLHttpRequest();
- xhr.addEventListener('load', () => callback(JSON.parse(xhr.responseText)));
+ xhr.addEventListener('loadend', () => callback(xhr.responseText ? JSON.parse(xhr.responseText) : null));
xhr.open('POST', 'http://127.0.0.1:8888');
xhr.withCredentials = true;
xhr.setRequestHeader('Content-Type', 'text/json');