SubscriptionCollection
The collection of subscriptions. This is an extended class of Map.
Extends
Map
<string
,SubscriptionType
<T
,K
>>
Type parameters
Type parameter | Value |
---|---|
K extends ConnectionTypes | ConnectionTypes |
T extends SubscriptionTypes | SubscriptionTypes |
Constructors
new SubscriptionCollection()
Parameters
Parameter | Type |
---|---|
entries ? | readonly readonly [string , SubscriptionType <T , K >][] |
Returns
SubscriptionCollection
<K
, T
>
Inherited from
Map<string, SubscriptionType<T, K>>.constructor
Source
node_modules/.pnpm/typescript@5.5.2/node_modules/typescript/lib/lib.es2015.collection.d.ts:50
new SubscriptionCollection()
Parameters
Parameter | Type |
---|---|
iterable ? | Iterable <readonly [string , SubscriptionType <T , K >]> |
Returns
SubscriptionCollection
<K
, T
>
Inherited from
Map<string, SubscriptionType<T, K>>.constructor
Source
node_modules/.pnpm/typescript@5.5.2/node_modules/typescript/lib/lib.es2015.collection.d.ts:49
Properties
Property | Modifier | Type | Description | Inherited from |
---|---|---|---|---|
[toStringTag] | readonly | string | - | Map.[toStringTag] |
size | readonly | number | Map.size | |
[species] | readonly | MapConstructor | - | Map.[species] |
Methods
[iterator]
()
Returns an iterable of entries in the map.
Returns
IterableIterator
<[string
, SubscriptionType
<T
, K
>]>
Inherited from
Map.[iterator]
Source
node_modules/.pnpm/typescript@5.5.2/node_modules/typescript/lib/lib.es2015.iterable.d.ts:119
clear()
Returns
void
Inherited from
Map.clear
Source
node_modules/.pnpm/typescript@5.5.2/node_modules/typescript/lib/lib.es2015.collection.d.ts:20
delete()
Parameters
Parameter | Type |
---|---|
key | string |
Returns
boolean
true if an element in the Map existed and has been removed, or false if the element does not exist.
Inherited from
Map.delete
Source
node_modules/.pnpm/typescript@5.5.2/node_modules/typescript/lib/lib.es2015.collection.d.ts:24
entries()
Returns an iterable of key, value pairs for every entry in the map.
Returns
IterableIterator
<[string
, SubscriptionType
<T
, K
>]>
Inherited from
Map.entries
Source
node_modules/.pnpm/typescript@5.5.2/node_modules/typescript/lib/lib.es2015.iterable.d.ts:124
exist()
Checks whether a subscription exists in the collection by its type and options.
Type parameters
Type parameter |
---|
U extends SubscriptionTypes |
Parameters
Parameter | Type | Description |
---|---|---|
type | U | The type of the subscription. |
options | SubscriptionTypeOptions [U ] | The options used to create the subscription. |
Returns
SubscriptionType
<U
, K
>
Whether the subscription exists. If it exists, the subscription is returned.
Source
twitchfy/packages/eventsub/src/structures/SubscriptionCollection.ts:38
forEach()
Executes a provided function once per each key/value pair in the Map, in insertion order.
Parameters
Parameter | Type |
---|---|
callbackfn | (value : SubscriptionType <T , K >, key : string , map : Map <string , SubscriptionType <T , K >>) => void |
thisArg ? | any |
Returns
void
Inherited from
Map.forEach
Source
node_modules/.pnpm/typescript@5.5.2/node_modules/typescript/lib/lib.es2015.collection.d.ts:28
get()
Gets a subscription from the collection by its id.
Type parameters
Type parameter |
---|
U extends SubscriptionTypes |
Parameters
Parameter | Type | Description |
---|---|---|
id | string | The id of the subscription. |
Returns
SubscriptionType
<U
, K
>
The subscription if it exists, otherwise undefined.
Overrides
Map.get
Source
twitchfy/packages/eventsub/src/structures/SubscriptionCollection.ts:18
has()
Parameters
Parameter | Type |
---|---|
key | string |
Returns
boolean
boolean indicating whether an element with the specified key exists or not.
Inherited from
Map.has
Source
node_modules/.pnpm/typescript@5.5.2/node_modules/typescript/lib/lib.es2015.collection.d.ts:37
keys()
Returns an iterable of keys in the map
Returns
IterableIterator
<string
>
Inherited from
Map.keys
Source
node_modules/.pnpm/typescript@5.5.2/node_modules/typescript/lib/lib.es2015.iterable.d.ts:129
set()
Sets a subscription into collection.
Type parameters
Type parameter |
---|
U extends SubscriptionTypes |
Parameters
Parameter | Type | Description |
---|---|---|
id | string | The id of the subscription. |
value | SubscriptionType <U , K > | The subscription to set. |
Returns
this
The updated collection.
Overrides
Map.set
Source
twitchfy/packages/eventsub/src/structures/SubscriptionCollection.ts:28
values()
Returns an iterable of values in the map
Returns
IterableIterator
<SubscriptionType
<T
, K
>>
Inherited from
Map.values
Source
node_modules/.pnpm/typescript@5.5.2/node_modules/typescript/lib/lib.es2015.iterable.d.ts:134