Skip to content

Commit

Permalink
version 3.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
georapbox committed Oct 4, 2017
1 parent a6d40db commit 72a1b35
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ engines:
enabled: false
eslint:
enabled: true
channel: "eslint-3"
channel: "eslint-4"
csslint:
enabled: false
duplication:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## v3.3.0
- If there is no subscriber for a topic, delete topic property when unsubscribing. Used to leave it as an empty array before.
- Keep devDependencies up to date.

## v3.2.7
Allow passing multiple data arguments to `publish` and `publishSync` methods.
```js
Expand Down
22 changes: 9 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ callback function, to be executed when the topic/event is observed.

**Kind**: instance method of <code>[PubSub](#PubSub)</code>
**Returns**: <code>number</code> - The topic's token
**this**: <code>{PubSub}</code>

| Param | Type | Default | Description |
| --- | --- | --- | --- |
Expand All @@ -89,7 +88,6 @@ indicating the event will be published only one time.

**Kind**: instance method of <code>[PubSub](#PubSub)</code>
**Returns**: <code>number</code> - The topic's token
**this**: <code>{PubSub}</code>

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -112,7 +110,6 @@ For synchronous topic publication check `publishSync`.

**Kind**: instance method of <code>[PubSub](#PubSub)</code>
**Returns**: <code>boolean</code> - Returns `true` if topic exists and event is published; otheriwse `false`
**this**: <code>{PubSub}</code>

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -134,7 +131,6 @@ Publishes a topic **synchronously**, passing the data to its subscribers.

**Kind**: instance method of <code>[PubSub](#PubSub)</code>
**Returns**: <code>boolean</code> - Returns `true` if topic exists and event is published; otheriwse `false`
**this**: <code>{PubSub}</code>

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -157,7 +153,6 @@ or based on a tokenized reference to the subscription.

**Kind**: instance method of <code>[PubSub](#PubSub)</code>
**Returns**: <code>boolean</code> \| <code>string</code> - Returns `false` if `topic` does not match a subscribed event; otherwise the topic's name
**this**: <code>{PubSub}</code>

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -178,13 +173,14 @@ Clears all subscriptions whatsoever.

**Kind**: instance method of <code>[PubSub](#PubSub)</code>
**Returns**: <code>[PubSub](#PubSub)</code> - The PubSub instance.
**this**: <code>{PubSub}</code>
**Example**
```js
var pubsub = new PubSub();
...
...
pubsub.subscribe('message1', function () {});
pubsub.subscribe('message2', function () {});
pubsub.subscribe('message3', function () {});
pubsub.unsubscribeAll();
pubsub.hasSubscribers(); // -> false
```
<a name="PubSub+hasSubscribers"></a>

Expand All @@ -194,7 +190,6 @@ If `topic` is not provided, checks if there is at least one subscriber.

**Kind**: instance method of <code>[PubSub](#PubSub)</code>
**Returns**: <code>boolean</code> - Returns `true` there are subscribers; otherwise `false`
**this**: <code>{PubSub}</code>

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -216,9 +211,10 @@ pubsub.hasSubscribers('message');
Gets all the subscribers as a set of key value pairs that
represent the topic's name and the event listener(s) bound.

**NOTE**: Mutating the result of this method does not affect the real subscribers. This is for reference only.

**Kind**: instance method of <code>[PubSub](#PubSub)</code>
**Returns**: <code>object</code> - A readonly object with all subscribers.
**this**: <code>{PubSub}</code>
**Example**
```js
var pubsub = new PubSub();
Expand All @@ -235,9 +231,10 @@ pubsub.subscribers();
### .subscribersByTopic(topic) ⇒ <code>array</code>
Gets subscribers for a specific topic.

**NOTE**: Mutating the result of this method does not affect the real subscribers. This is for reference only.

**Kind**: instance method of <code>[PubSub](#PubSub)</code>
**Returns**: <code>array</code> - An array of all subscribers for a topic if exist; otherwise an empty array
**this**: <code>{PubSub}</code>
**Returns**: <code>array</code> - A copy array of all subscribers for a topic if exist; otherwise an empty array

| Param | Type | Description |
| --- | --- | --- |
Expand Down Expand Up @@ -267,7 +264,6 @@ Creates aliases for public methods.

**Kind**: instance method of <code>[PubSub](#PubSub)</code>
**Returns**: <code>[PubSub](#PubSub)</code> - The PubSub instance.
**this**: <code>{PubSub}</code>

| Param | Type | Description |
| --- | --- | --- |
Expand Down
4 changes: 2 additions & 2 deletions dist/pubsub.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 dist/pubsub.min.js.map

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "PubSub",
"version": "3.2.7",
"version": "3.3.0",
"description": "Javascript implementation of the Publish/Subscribe pattern.",
"main": "src/pubsub.js",
"scripts": {
Expand Down Expand Up @@ -32,10 +32,10 @@
},
"homepage": "https://github.com/georapbox/PubSub#readme",
"devDependencies": {
"eslint": "~4.6.1",
"eslint": "~4.8.0",
"grunt": "~1.0.1",
"grunt-cli": "~1.2.0",
"grunt-contrib-uglify": "~3.0.1",
"grunt-contrib-uglify": "~3.1.0",
"grunt-remove-logging": "~0.2.0",
"jasmine-core": "~2.8.0",
"jsdoc-to-markdown": "~3.0.0",
Expand Down
Loading

0 comments on commit 72a1b35

Please sign in to comment.