diff --git a/README.md b/README.md
index c80633d..6c4bd21 100644
--- a/README.md
+++ b/README.md
@@ -38,8 +38,8 @@ For API updates and breaking changes, check the [CHANGELOG](https://github.com/g
* [.publish(topic, [data])](#PubSub+publish) ⇒ boolean
* [.publishSync(topic, [data])](#PubSub+publishSync) ⇒ boolean
* [.unsubscribe(topic)](#PubSub+unsubscribe) ⇒ boolean
| string
- * [.hasSubscribers(topic)](#PubSub+hasSubscribers) ⇒ Boolean
* [.unsubscribeAll()](#PubSub+unsubscribeAll) ⇒ [PubSub](#PubSub)
+ * [.hasSubscribers(topic)](#PubSub+hasSubscribers) ⇒ Boolean
* [.alias(aliasMap)](#PubSub+alias) ⇒ [PubSub](#PubSub)
@@ -160,6 +160,21 @@ pubsub.unsubscribe('user_add');
// Unsubscribe using a tokenized reference to the subscription.
pubsub.unsubscribe(onUserAdd);
```
+
+
+### pubSub.unsubscribeAll() ⇒ [PubSub](#PubSub)
+Clears all subscriptions whatsoever.
+
+**Kind**: instance method of [PubSub](#PubSub)
+**Returns**: [PubSub](#PubSub)
- The PubSub instance.
+**this**: {PubSub}
+**Example**
+```js
+var pubsub = new PubSub();
+...
+...
+pubsub.unsubscribeAll();
+```
### pubSub.hasSubscribers(topic) ⇒ Boolean
@@ -183,21 +198,6 @@ pubsub.on('message', function (data) {
pubsub.hasSubscribers('message');
// -> true
```
-
-
-### pubSub.unsubscribeAll() ⇒ [PubSub](#PubSub)
-Clears all subscriptions whatsoever.
-
-**Kind**: instance method of [PubSub](#PubSub)
-**Returns**: [PubSub](#PubSub)
- The PubSub instance.
-**this**: {PubSub}
-**Example**
-```js
-var pubsub = new PubSub();
-...
-...
-pubsub.unsubscribeAll();
-```
### pubSub.alias(aliasMap) ⇒ [PubSub](#PubSub)
diff --git a/src/pubsub.js b/src/pubsub.js
index b6929d6..24c7bd0 100644
--- a/src/pubsub.js
+++ b/src/pubsub.js
@@ -226,6 +226,31 @@
return false;
};
+ /**
+ * Clears all subscriptions whatsoever.
+ *
+ * @memberof PubSub
+ * @this {PubSub}
+ * @return {PubSub} The PubSub instance.
+ * @example
+ *
+ * var pubsub = new PubSub();
+ * ...
+ * ...
+ * pubsub.unsubscribeAll();
+ */
+ PubSub.prototype.unsubscribeAll = function () {
+ var prop;
+
+ for (prop in this.topics) {
+ if (Object.hasOwnProperty.call(this.topics, prop)) {
+ this.topics[prop] = [];
+ }
+ }
+
+ return this;
+ };
+
/**
* Checks if there are subscribers for a specific topic.
*
@@ -253,31 +278,6 @@
return false;
};
- /**
- * Clears all subscriptions whatsoever.
- *
- * @memberof PubSub
- * @this {PubSub}
- * @return {PubSub} The PubSub instance.
- * @example
- *
- * var pubsub = new PubSub();
- * ...
- * ...
- * pubsub.unsubscribeAll();
- */
- PubSub.prototype.unsubscribeAll = function () {
- var prop;
-
- for (prop in this.topics) {
- if (Object.hasOwnProperty.call(this.topics, prop)) {
- this.topics[prop] = [];
- }
- }
-
- return this;
- };
-
/**
* Creates aliases for public methods.
*