Share via


TurnContextStateCollection class

A collection for managing state within a turn context.

Extends

Map<any, any>

Constructors

TurnContextStateCollection(null | (readonly (readonly [any, any])[]))
TurnContextStateCollection(null | Iterable<readonly [any, any]>)

Inherited Properties

size
[species]
[toStringTag]

Methods

get(any)

Gets the value associated with the specified key.

get<T>(any)

Gets the value associated with the specified key.

pop(any)

Pops a value from the stack for the specified key.

push(any, any)

Pushes a value onto the stack for the specified key.

Inherited Methods

clear()
delete(any)
entries()

Returns an iterable of key, value pairs for every entry in the map.

forEach((value: any, key: any, map: Map<any, any>) => void, any)

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

has(any)
keys()

Returns an iterable of keys in the map

set(any, any)

Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated.

values()

Returns an iterable of values in the map

[iterator]()

Returns an iterable of entries in the map.

Constructor Details

TurnContextStateCollection(null | (readonly (readonly [any, any])[]))

new TurnContextStateCollection(entries?: null | (readonly (readonly [any, any])[]))

Parameters

entries

null | (readonly (readonly [any, any])[])

TurnContextStateCollection(null | Iterable<readonly [any, any]>)

new TurnContextStateCollection(iterable?: null | Iterable<readonly [any, any]>)

Parameters

iterable

null | Iterable<readonly [any, any]>

Inherited Property Details

size

size: number

Property Value

number

the number of elements in the Map.

Inherited From Map.size

[species]

static [species]: MapConstructor

Property Value

MapConstructor

Inherited From Map.__@species@1734

[toStringTag]

[toStringTag]: string

Property Value

string

Inherited From Map.__@toStringTag@1328

Method Details

get(any)

Gets the value associated with the specified key.

function get(key: any): any

Parameters

key

any

The key of the element to get.

Returns

any

The element associated with the specified key, or undefined if the key does not exist.

get<T>(any)

Gets the value associated with the specified key.

function get<T>(key: any): T

Parameters

key

any

The key of the element to get.

Returns

T

The element associated with the specified key, or undefined if the key does not exist.

pop(any)

Pops a value from the stack for the specified key.

function pop(key: any): any

Parameters

key

any

The key of the element to pop.

Returns

any

The value that was popped from the stack.

push(any, any)

Pushes a value onto the stack for the specified key.

function push(key: any, value: any)

Parameters

key

any

The key of the element to push.

value

any

The value to push onto the stack.

Inherited Method Details

clear()

function clear()

Inherited From Map.clear

delete(any)

function delete(key: any): boolean

Parameters

key

any

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

entries()

Returns an iterable of key, value pairs for every entry in the map.

function entries(): IterableIterator<[any, any]>

Returns

IterableIterator<[any, any]>

Inherited From Map.entries

forEach((value: any, key: any, map: Map<any, any>) => void, any)

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

function forEach(callbackfn: (value: any, key: any, map: Map<any, any>) => void, thisArg?: any)

Parameters

callbackfn

(value: any, key: any, map: Map<any, any>) => void

thisArg

any

Inherited From Map.forEach

has(any)

function has(key: any): boolean

Parameters

key

any

Returns

boolean

boolean indicating whether an element with the specified key exists or not.

Inherited From Map.has

keys()

Returns an iterable of keys in the map

function keys(): IterableIterator<any>

Returns

IterableIterator<any>

Inherited From Map.keys

set(any, any)

Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated.

function set(key: any, value: any): TurnContextStateCollection

Parameters

key

any

value

any

Returns

Inherited From Map.set

values()

Returns an iterable of values in the map

function values(): IterableIterator<any>

Returns

IterableIterator<any>

Inherited From Map.values

[iterator]()

Returns an iterable of entries in the map.

function [iterator](): IterableIterator<[any, any]>

Returns

IterableIterator<[any, any]>

Inherited From Map.__@iterator@456