Skip to content

Commit f5249b1

Browse files
committed
add stateless utility methods to manage subscription
1 parent 4f9d197 commit f5249b1

File tree

8 files changed

+16673
-21
lines changed

8 files changed

+16673
-21
lines changed

dist/titanium/pubnub.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2503,6 +2503,11 @@ var _default = function () {
25032503
(0, _defineProperty2["default"])(this, "whereNow", void 0);
25042504
(0, _defineProperty2["default"])(this, "getState", void 0);
25052505
(0, _defineProperty2["default"])(this, "setState", void 0);
2506+
(0, _defineProperty2["default"])(this, "iAmHere", void 0);
2507+
(0, _defineProperty2["default"])(this, "iAmAway", void 0);
2508+
(0, _defineProperty2["default"])(this, "setPresenceState", void 0);
2509+
(0, _defineProperty2["default"])(this, "handshake", void 0);
2510+
(0, _defineProperty2["default"])(this, "receiveMessages", void 0);
25062511
(0, _defineProperty2["default"])(this, "grant", void 0);
25072512
(0, _defineProperty2["default"])(this, "grantToken", void 0);
25082513
(0, _defineProperty2["default"])(this, "audit", void 0);
@@ -2646,6 +2651,28 @@ var _default = function () {
26462651
this.whereNow = _endpoint["default"].bind(this, modules, presenceWhereNowEndpointConfig);
26472652
this.getState = _endpoint["default"].bind(this, modules, presenceGetStateConfig);
26482653
this.setState = subscriptionManager.adaptStateChange.bind(subscriptionManager);
2654+
this.iAmHere = _endpoint["default"].bind(this, modules, presenceHeartbeatEndpointConfig);
2655+
this.iAmAway = _endpoint["default"].bind(this, modules, presenceLeaveEndpointConfig);
2656+
this.setPresenceState = _endpoint["default"].bind(this, modules, presenceSetStateConfig);
2657+
2658+
this.handshake = function (args, cb) {
2659+
return subscribeEndpoint({
2660+
channels: args.channels,
2661+
channelGroups: args.channelGroups,
2662+
state: {}
2663+
}, cb);
2664+
};
2665+
2666+
this.receiveMessages = function (args, cb) {
2667+
return subscribeEndpoint({
2668+
channels: args.channels,
2669+
channelGroups: args.channelGroups,
2670+
timetoken: args.timetoken,
2671+
region: args.region,
2672+
state: {}
2673+
}, cb);
2674+
};
2675+
26492676
this.grant = _endpoint["default"].bind(this, modules, grantEndpointConfig);
26502677
this.grantToken = _endpoint["default"].bind(this, modules, grantTokenEndpointConfig);
26512678
this.audit = _endpoint["default"].bind(this, modules, auditEndpointConfig);

dist/titanium/pubnub.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/web/pubnub.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5772,6 +5772,11 @@ var _default = function () {
57725772
(0, _defineProperty2["default"])(this, "whereNow", void 0);
57735773
(0, _defineProperty2["default"])(this, "getState", void 0);
57745774
(0, _defineProperty2["default"])(this, "setState", void 0);
5775+
(0, _defineProperty2["default"])(this, "iAmHere", void 0);
5776+
(0, _defineProperty2["default"])(this, "iAmAway", void 0);
5777+
(0, _defineProperty2["default"])(this, "setPresenceState", void 0);
5778+
(0, _defineProperty2["default"])(this, "handshake", void 0);
5779+
(0, _defineProperty2["default"])(this, "receiveMessages", void 0);
57755780
(0, _defineProperty2["default"])(this, "grant", void 0);
57765781
(0, _defineProperty2["default"])(this, "grantToken", void 0);
57775782
(0, _defineProperty2["default"])(this, "audit", void 0);
@@ -5915,6 +5920,28 @@ var _default = function () {
59155920
this.whereNow = _endpoint["default"].bind(this, modules, presenceWhereNowEndpointConfig);
59165921
this.getState = _endpoint["default"].bind(this, modules, presenceGetStateConfig);
59175922
this.setState = subscriptionManager.adaptStateChange.bind(subscriptionManager);
5923+
this.iAmHere = _endpoint["default"].bind(this, modules, presenceHeartbeatEndpointConfig);
5924+
this.iAmAway = _endpoint["default"].bind(this, modules, presenceLeaveEndpointConfig);
5925+
this.setPresenceState = _endpoint["default"].bind(this, modules, presenceSetStateConfig);
5926+
5927+
this.handshake = function (args, cb) {
5928+
return subscribeEndpoint({
5929+
channels: args.channels,
5930+
channelGroups: args.channelGroups,
5931+
state: {}
5932+
}, cb);
5933+
};
5934+
5935+
this.receiveMessages = function (args, cb) {
5936+
return subscribeEndpoint({
5937+
channels: args.channels,
5938+
channelGroups: args.channelGroups,
5939+
timetoken: args.timetoken,
5940+
region: args.region,
5941+
state: {}
5942+
}, cb);
5943+
};
5944+
59185945
this.grant = _endpoint["default"].bind(this, modules, grantEndpointConfig);
59195946
this.grantToken = _endpoint["default"].bind(this, modules, grantTokenEndpointConfig);
59205947
this.audit = _endpoint["default"].bind(this, modules, auditEndpointConfig);

dist/web/pubnub.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/core/pubnub-common.js

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/core/pubnub-common.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)