Skip to content

Commit

Permalink
fix request params
Browse files Browse the repository at this point in the history
  • Loading branch information
Izumi-kun committed Aug 20, 2017
1 parent f9873f1 commit ef9d910
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dist/jquery.longpoll.min.js

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jquery-longpoll-client",
"version": "0.2.1",
"version": "0.3.0",
"description": "Simple client-side longpoll implementation",
"keywords": ["jquery", "ajax", "longpoll", "comet"],
"main": "src/jquery.longpoll.js",
Expand Down
12 changes: 5 additions & 7 deletions src/jquery.longpoll.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,15 @@
data: params,
dataType: "json"
}).done(function (response) {
var triggered = false;
$.each(response.params, function (id, value) {
if (params[id] != value) {
triggered = true;
if (params[id] !== value) {
params = response.params;
if ($.isFunction(self.callback)) {
self.callback.call(self, response.data);
}
return false;
}
});
params = response.params;
if (triggered && $.isFunction(self.callback)) {
self.callback.call(self, response.data);
}
timeoutId = setTimeout(doLoop, settings.pollInterval);
}).fail(function (e) {
if (e.status) {
Expand Down

0 comments on commit ef9d910

Please sign in to comment.