Skip to main content

Class: Subscription

A convenience API for managing an individual subscription.

Hierarchy

Properties

erc1271ContractAddress

Readonly erc1271ContractAddress: undefined | EthereumAddress


streamPartId

Readonly streamPartId: StreamPartID

Methods

[asyncIterator]

[asyncIterator](): AsyncIterator\<Message, any, undefined>

Returns

AsyncIterator\<Message, any, undefined>

Inherited from

MessageStream.[asyncIterator]


off

off\<E>(eventName, listener): void

Removes an event listener from the subscription.

Type parameters

NameType
Eextends keyof SubscriptionEvents

Parameters

NameTypeDescription
eventNameEevent name, see SubscriptionEvents for options
listenerSubscriptionEvents[E]the callback function to remove

Returns

void


on

on\<E>(eventName, listener): void

Adds an event listener to the subscription.

Type parameters

NameType
Eextends keyof SubscriptionEvents

Parameters

NameTypeDescription
eventNameEevent name, see SubscriptionEvents for options
listenerSubscriptionEvents[E]the callback function

Returns

void


once

once\<E>(eventName, listener): void

Adds an event listener to the subscription that is invoked only once.

Type parameters

NameType
Eextends keyof SubscriptionEvents

Parameters

NameTypeDescription
eventNameEevent name, see SubscriptionEvents for options
listenerSubscriptionEvents[E]the callback function

Returns

void


unsubscribe

unsubscribe(): Promise\<void>

Unsubscribes this subscription.

Returns

Promise\<void>

Remarks

The instance should not be used after calling this.