Skip to content

Commit

Permalink
Minor code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
pinceladasdaweb committed Nov 27, 2015
1 parent 31193b5 commit 1f7e154
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions build/tweetlight.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/tweetlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
this.counter = options.counter;
this.showImageProfile = options.showImageProfile || false;
this.endpoint = '../request.php';
this.onComplete = options.onComplete || function () {};
this.onComplete = options.onComplete || undefined;

this.fetch();
};
Expand All @@ -44,7 +44,7 @@
xhttp.open('GET', path, true);
xhttp.onreadystatechange = function () {
if (this.readyState === 4) {
if (this.status >= 200 && this.status < 400) {
if ((this.status >= 200 && this.status < 300) || this.status === 304) {
var json = JSON.parse(this.responseText);
callback.call(self, json);
} else {
Expand All @@ -65,7 +65,7 @@

this.displayTweets(tweets);

this.onComplete();
typeof this.onComplete === 'function' && this.onComplete.call();
} else {
this.displayError(tweets);
}
Expand Down

0 comments on commit 1f7e154

Please sign in to comment.