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

# Class: SubscriptionCollection

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

## Hierarchy

**SubscriptionCollection**

## 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>

###  constructor

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

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

**Parameters:**

| Param | Type |
| ------ | ------ |
| `Optional` topics |  `string` &#124; `Array`<`string`>|
| `Optional` callback | [EventSubscriptionCallback](../#EventSubscriptionCallback) |

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

___

## Methods

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

###  subscribe

▸ **subscribe**(topics: * `string` &#124; `Array`<`string`>*, callback: *[EventSubscriptionCallback](../#EventSubscriptionCallback)*): `void`

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

Subscribe a single callback to a set of events

**Parameters:**

| Param | Type | Description |
| ------ | ------ | ------ |
| topics |  `string` &#124; `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/6f704389/lib/pubSubEventService.ts#L184)*

Unsubscribe from all of the events

**Parameters:**

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

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

___

