From caef1d0648cc55bd6708c91bed3bcc26c6f4f7ea Mon Sep 17 00:00:00 2001 From: oscarotero Date: Sat, 22 Jul 2017 12:39:52 +0200 Subject: [PATCH] prettier --- src/AjaxSource.js | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/src/AjaxSource.js b/src/AjaxSource.js index 7ec6a85..5cd3024 100644 --- a/src/AjaxSource.js +++ b/src/AjaxSource.js @@ -27,25 +27,22 @@ export default class AjaxSource extends Source { } this.timeout = setTimeout(() => { - getJson( - this.endpoint + '?q=' + query, - data => { - this.load(data); - this.cache[query] = this.data; - this.update(); - - clearTimeout(this.timeout); - delete this.timeout; - - if (this.query && query !== this.query) { - query = this.query; - delete this.query; - return this.update(); - } + getJson(this.endpoint + '?q=' + query, data => { + this.load(data); + this.cache[query] = this.data; + this.update(); + clearTimeout(this.timeout); + delete this.timeout; + + if (this.query && query !== this.query) { + query = this.query; delete this.query; + return this.update(); } - ); + + delete this.query; + }); }, 200); } @@ -69,7 +66,6 @@ export default class AjaxSource extends Source { } } - function getJson(url, done) { const request = new XMLHttpRequest(); @@ -85,4 +81,4 @@ function getJson(url, done) { }; request.send(); -} \ No newline at end of file +}