Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Jul 22, 2017
1 parent deb35ff commit caef1d0
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions src/AjaxSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -69,7 +66,6 @@ export default class AjaxSource extends Source {
}
}


function getJson(url, done) {
const request = new XMLHttpRequest();

Expand All @@ -85,4 +81,4 @@ function getJson(url, done) {
};

request.send();
}
}

0 comments on commit caef1d0

Please sign in to comment.