Comparing version 4.2.1 to 4.2.2
{ | ||
"name": "pubnub", | ||
"version": "4.2.1", | ||
"version": "4.2.2", | ||
"main": "dist/web/pubnub.min.js", | ||
@@ -5,0 +5,0 @@ "license": "https://github.com/pubnub/javascript/blob/master/LICENSE", |
## [v4.2.2](https://github.com/pubnub/javascript/tree/v4.2.2) | ||
[Full Changelog](https://github.com/pubnub/javascript/compare/v4.2.1...v4.2.2) | ||
- ⭐add promise support on setState operation (@jskrzypek) | ||
## [v4.2.1](https://github.com/pubnub/javascript/tree/v4.2.1) | ||
@@ -3,0 +13,0 @@ |
@@ -39,2 +39,7 @@ 'use strict'; | ||
}, { | ||
key: 'stopPolling', | ||
value: function stopPolling() { | ||
clearInterval(this._timeTimer); | ||
} | ||
}, { | ||
key: '_performTimeLoop', | ||
@@ -41,0 +46,0 @@ value: function _performTimeLoop() { |
@@ -97,3 +97,3 @@ 'use strict'; | ||
this._setStateEndpoint({ state: state, channels: channels, channelGroups: channelGroups }, callback); | ||
return this._setStateEndpoint({ state: state, channels: channels, channelGroups: channelGroups }, callback); | ||
} | ||
@@ -165,2 +165,3 @@ }, { | ||
this._region = null; | ||
this._reconnectionManager.stopPolling(); | ||
} | ||
@@ -196,2 +197,3 @@ | ||
this._stopHeartbeatTimer(); | ||
this._reconnectionManager.stopPolling(); | ||
} | ||
@@ -198,0 +200,0 @@ }, { |
{ | ||
"name": "pubnub", | ||
"preferGlobal": false, | ||
"version": "4.2.1", | ||
"version": "4.2.2", | ||
"author": "PubNub <support@pubnub.com>", | ||
@@ -6,0 +6,0 @@ "description": "Publish & Subscribe Real-time Messaging with PubNub", |
@@ -21,3 +21,3 @@ # PubNub JavaScript SDK (V4) | ||
## CDN Links | ||
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.2.1.min.js | ||
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.2.1.js | ||
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.2.2.min.js | ||
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.2.2.js |
@@ -26,2 +26,6 @@ import TimeEndpoint from '../endpoints/time'; | ||
stopPolling() { | ||
clearInterval(this._timeTimer); | ||
} | ||
_performTimeLoop() { | ||
@@ -28,0 +32,0 @@ this._timeEndpoint((status: StatusAnnouncement) => { |
@@ -107,3 +107,3 @@ /* @flow */ | ||
this._setStateEndpoint({ state, channels, channelGroups }, callback); | ||
return this._setStateEndpoint({ state, channels, channelGroups }, callback); | ||
} | ||
@@ -162,2 +162,3 @@ | ||
this._region = null; | ||
this._reconnectionManager.stopPolling(); | ||
} | ||
@@ -188,2 +189,3 @@ | ||
this._stopHeartbeatTimer(); | ||
this._reconnectionManager.stopPolling(); | ||
} | ||
@@ -190,0 +192,0 @@ |
@@ -81,3 +81,18 @@ /* global describe, beforeEach, it, before, afterEach, after */ | ||
}); | ||
it('supports promises', (done) => { | ||
const scope = utils.createNock().get('/v2/presence/sub-key/mySubscribeKey/channel/ch1/uuid/myUUID/data') | ||
.query({ pnsdk: 'PubNub-JS-Nodejs/' + pubnub.getVersion(), uuid: 'myUUID', state: '{"hello":"there"}' }) | ||
.reply(200, '{ "status": 200, "message": "OK", "payload": { "age" : 20, "status" : "online" }, "service": "Presence"}'); | ||
let promise = pubnub.setState({ channels: ['ch1'], state: { hello: 'there' } }); | ||
assert.ok(promise); | ||
assert(typeof promise.then === 'function'); | ||
promise.then((response) => { | ||
assert.deepEqual(response.state, { age: 20, status: 'online' }); | ||
assert.equal(scope.isDone(), true); | ||
done(); | ||
}).catch(done); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1512567
12446