Skip to content

Commit

Permalink
Merge pull request #25 from kuzzleio/bugfix
Browse files Browse the repository at this point in the history
a few bugfixes
  • Loading branch information
scottinet committed Dec 1, 2015
2 parents bc3e901 + f8602c2 commit 4220530
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kuzzle-sdk",
"version": "1.0.3",
"version": "1.0.4",
"description": "Official Javascript SDK for Kuzzle",
"author": "The Kuzzle Team <[email protected]>",
"repository": {
Expand Down
8 changes: 3 additions & 5 deletions src/kuzzle.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,12 @@ Kuzzle.prototype.connect = function (cb) {
}

self.eventListeners.disconnected.forEach(function (listener) {
listener();
listener.fn();
});
});

self.socket.on('reconnect', function () {
self.state = 'reconnecting';
self.state = 'connected';

// renew subscriptions
if (self.autoResubscribe) {
Expand All @@ -312,10 +312,8 @@ Kuzzle.prototype.connect = function (cb) {

// alert listeners
self.eventListeners.reconnected.forEach(function (listener) {
listener();
listener.fn();
});

self.state = 'connected';
});

return this;
Expand Down
4 changes: 2 additions & 2 deletions test/kuzzle/constructor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ describe('Kuzzle constructor', () => {

this.timeout(200);

kuzzle.eventListeners.disconnected.push(function () { listenerCalled = true; });
kuzzle.addListener('disconnected', function () { listenerCalled = true; });

setTimeout(() => {
try {
Expand Down Expand Up @@ -412,7 +412,7 @@ describe('Kuzzle constructor', () => {

this.timeout(200);

kuzzle.eventListeners.reconnected.push(function () { listenersCalled = true; });
kuzzle.addListener('reconnected', function () { listenersCalled = true; });
kuzzle.queuing = true;

setTimeout(() => {
Expand Down

0 comments on commit 4220530

Please sign in to comment.