[API Reference](../README.md) > [SubscriptionCollection](../classes/SubscriptionCollection.md)



# Class: SubscriptionCollection


Creates a collection of subscriptions to which one can unsubscribe all at once.

## Implements

* [IEventSubscription](../interfaces/IEventSubscription.md)

## Index

### Constructors

* [constructor](SubscriptionCollection.md#constructor)


### Methods

* [subscribe](SubscriptionCollection.md#subscribe)
* [unsubscribe](SubscriptionCollection.md#unsubscribe)



---
## Constructors
<a id="constructor"></a>


### ⊕ **new SubscriptionCollection**(topics?: *`string`⎮`Array`.<`string`>*, callback?: *[EventSubscriptionCallback](../#EventSubscriptionCallback)*): [SubscriptionCollection](SubscriptionCollection.md)


*Defined in [pubSubEventService.ts:154](https://github.com/daostack/arc.js/blob/f343aa24/lib/pubSubEventService.ts#L154)*



**Parameters:**

| Param | Type | Description |
| ------ | ------ | ------ |
| topics | `string`⎮`Array`.<`string`>   |  - |
| callback | [EventSubscriptionCallback](../#EventSubscriptionCallback)   |  - |





**Returns:** [SubscriptionCollection](SubscriptionCollection.md)

---


## Methods
<a id="subscribe"></a>

###  subscribe

► **subscribe**(topics: *`string`⎮`Array`.<`string`>*, callback: *[EventSubscriptionCallback](../#EventSubscriptionCallback)*): `void`



*Defined in [pubSubEventService.ts:169](https://github.com/daostack/arc.js/blob/f343aa24/lib/pubSubEventService.ts#L169)*



Subscribe a single callback to a set of events


**Parameters:**

| Param | Type | Description |
| ------ | ------ | ------ |
| topics | `string`⎮`Array`.<`string`>   |  - |
| callback | [EventSubscriptionCallback](../#EventSubscriptionCallback)   |  - |





**Returns:** `void`





___

<a id="unsubscribe"></a>

###  unsubscribe

► **unsubscribe**(milliseconds?: *`number`*): `Promise`.<`void`>



*Implementation of [IEventSubscription](../interfaces/IEventSubscription.md).[unsubscribe](../interfaces/IEventSubscription.md#unsubscribe)*

*Defined in [pubSubEventService.ts:184](https://github.com/daostack/arc.js/blob/f343aa24/lib/pubSubEventService.ts#L184)*



Unsubscribe from all of the events


**Parameters:**

| Param | Type | Default value | Description |
| ------ | ------ | ------ | ------ |
| milliseconds | `number`  |  -1 |   number of milliseconds to timeout.Default is -1 which means not to timeout at all. |





**Returns:** `Promise`.<`void`>





___


