Skip to content

SubscriptionCollection

The collection of subscriptions. This is an extended class of Map.

Extends

Type parameters

Type parameterValue
K extends ConnectionTypesConnectionTypes
T extends SubscriptionTypesSubscriptionTypes

Constructors

new SubscriptionCollection()

1
new SubscriptionCollection<K, T>(entries?: readonly readonly [string, SubscriptionType<T, K>][]): SubscriptionCollection<K, T>

Parameters

ParameterType
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()

1
new SubscriptionCollection<K, T>(iterable?: Iterable<readonly [string, SubscriptionType<T, K>]>): SubscriptionCollection<K, T>

Parameters

ParameterType
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

PropertyModifierTypeDescriptionInherited from
[toStringTag]readonlystring-Map.[toStringTag]
sizereadonlynumberMap.size
[species]readonlyMapConstructor-Map.[species]

Methods

[iterator]()

1
iterator: IterableIterator<[string, SubscriptionType<T, K>]>

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()

1
clear(): void

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()

1
delete(key: string): boolean

Parameters

ParameterType
keystring

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()

1
entries(): IterableIterator<[string, SubscriptionType<T, K>]>

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()

1
exist<U>(type: U, options: SubscriptionTypeOptions[U]): SubscriptionType<U, K>

Checks whether a subscription exists in the collection by its type and options.

Type parameters

Type parameter
U extends SubscriptionTypes

Parameters

ParameterTypeDescription
typeUThe type of the subscription.
optionsSubscriptionTypeOptions[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()

1
forEach(callbackfn: (value: SubscriptionType<T, K>, key: string, map: Map<string, SubscriptionType<T, K>>) => void, thisArg?: any): void

Executes a provided function once per each key/value pair in the Map, in insertion order.

Parameters

ParameterType
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()

1
get<U>(id: string): SubscriptionType<U, K>

Gets a subscription from the collection by its id.

Type parameters

Type parameter
U extends SubscriptionTypes

Parameters

ParameterTypeDescription
idstringThe 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()

1
has(key: string): boolean

Parameters

ParameterType
keystring

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()

1
keys(): IterableIterator<string>

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()

1
set<U>(id: string, value: SubscriptionType<U, K>): this

Sets a subscription into collection.

Type parameters

Type parameter
U extends SubscriptionTypes

Parameters

ParameterTypeDescription
idstringThe id of the subscription.
valueSubscriptionType<U, K>The subscription to set.

Returns

this

The updated collection.

Overrides

Map.set

Source

twitchfy/packages/eventsub/src/structures/SubscriptionCollection.ts:28


values()

1
values(): IterableIterator<SubscriptionType<T, K>>

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