Skip to content

Commit

Permalink
Merge pull request #25 from pubnub/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
MaxPresman authored Jan 11, 2018
2 parents f0156b6 + d20f89c commit 42233a9
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 24 deletions.
14 changes: 13 additions & 1 deletion .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
name: pubnub-angular
version: 4.0.2
version: 4.1.0
schema: 1
scm: github.com/pubnub/pubnub-angular
changelog:
- version: v4.1.0
date: 2017-10-30
changes:
- type: feature
text: Add deleteMessages and fetchMessages for v4 wrapper
- type: fix
text: Active events broadcaster only with the param triggerEvent
- version: v4.0.3
date: 2017-09-21
changes:
- type: feature
text: Add delegated method setHeartbeatInterval for v4 wrapper
- version: v4.0.2
date: 2016-11-14
changes:
Expand Down
24 changes: 23 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@

## [v4.1.0](https://github.com/pubnub/pubnub-angular/tree/v4.1.0)
November-30-2017


[Full Changelog](https://github.com/pubnub/pubnub-angular/compare/v4.0.3...v4.1.0)

- 🌟Add deleteMessages and fetchMessages for v4 wrapper
- 🐛Active events broadcaster only with the param triggerEvent




## [v4.0.3](https://github.com/pubnub/pubnub-angular/tree/v4.0.3)
September-21-2017


[Full Changelog](https://github.com/pubnub/pubnub-angular/compare/v4.0.2...v4.0.3)

- 🌟Add delegated method setHeartbeatInterval for v4 wrapper




## [v4.0.2](https://github.com/pubnub/pubnub-angular/tree/v4.0.2)
November-14-2016

Expand Down Expand Up @@ -41,7 +64,6 @@




- ⭐$pubnubChannel.$extend(): Avoid to share extensions across every $pubnubChannel objects.


Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ Your HTML page will include 2 key libraries:
- Or using CDNs:

```html
<script src="http(s)://cdn.pubnub.com/sdk/pubnub-angular/pubnub-angular-4.0.2.js"></script>
<script src="http(s)://cdn.pubnub.com/sdk/pubnub-angular/pubnub-angular-4.1.0.js"></script>
```

- Also available as minified:

```html
<script src="http(s)://cdn.pubnub.com/sdk/pubnub-angular/pubnub-angular-4.0.2.min.js"></script>
<script src="http(s)://cdn.pubnub.com/sdk/pubnub-angular/pubnub-angular-4.1.0.min.js"></script>
```

To utilize this wrapper, include the scripts in the following order:
Expand Down
25 changes: 20 additions & 5 deletions dist/pubnub-angular.js

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

2 changes: 1 addition & 1 deletion dist/pubnub-angular.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/pubnub-angular.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion karma.conf.pubnub-v4.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = function(config) {

// list of files / patterns to load in the browser
files: [
'test/polyfills/bind.js',
'node_modules/babel-polyfill/dist/polyfill.js',
'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js',
'bower_components/pubnub-v4/dist/web/pubnub.js',
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pubnub-angular",
"version": "4.0.2",
"version": "4.1.0",
"description": "Official PubNub AngularJS Package",
"license": "MIT",
"main": "dist/pubnub-angular.min.js",
Expand All @@ -22,6 +22,7 @@
],
"devDependencies": {
"babel-loader": "^6.2.7",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.18.0",
"babel-register": "^6.18.0",
"eslint": "^3.9.1",
Expand Down
19 changes: 11 additions & 8 deletions src/v4/config.pubnub-v4.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@
"getUUID",
"setAuthKey",
"addListener",
"removeListener",
"removeListener",
"unsubscribe",
"unsubscribeAll",
"unsubscribeAll",
"time",
"stop",
"encrypt",
"decrypt",
"setFilterExpression"
"encrypt",
"decrypt",
"setFilterExpression",
"setHeartbeatInterval"
],
"methods_to_wrap": [
"publish",
"fire",
"fire",
"deleteMessages",
"fetchMessages",
"hereNow",
"whereNow",
"setState",
Expand All @@ -28,7 +31,7 @@
"listChannels",
"removeChannels"
]
}, {
}, {
"channelGroups": [
"addChannels",
"deleteGroup",
Expand All @@ -46,4 +49,4 @@
"presence",
"status"
]
}
}
18 changes: 15 additions & 3 deletions src/v4/subscribe_events_broadcaster.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,20 @@ module.exports = class {
}

enableEventsBroadcast(eventsToBroadcast, args) {
let triggers = [];
if (!args.triggerEvents) {
return false;
} else if (args.triggerEvents === true) {
triggers = ['status', 'message', 'presence'];
} else {
triggers = args.triggerEvents;
}

eventsToBroadcast.forEach((eventToBroadcast) => {
if (eventToBroadcast === 'status') {
if (eventToBroadcast === 'status' && triggers.includes('status')) {
this.broadcastStatus = true;
}
if (eventToBroadcast === 'message') {
if (eventToBroadcast === 'message' && triggers.includes('message')) {
// Adds any message channel which are not presence channels
if (args.channels && args.channels.length > 0) {
args.channels.forEach((channel) => {
Expand All @@ -82,7 +91,7 @@ module.exports = class {
});
}
}
if (eventToBroadcast === 'presence') {
if (eventToBroadcast === 'presence' && triggers.includes('presence')) {
// Adds the presence channels of the current channels
if (args.withPresence) {
if (args.channels && args.channels.length > 0) {
Expand Down Expand Up @@ -110,8 +119,11 @@ module.exports = class {
}
}
});

if (this.subscribeListener === null) {
this.initializeSubscribeListener();
}

return true;
}
};

0 comments on commit 42233a9

Please sign in to comment.