Skip to main content

FluidMap Interface

Like TypeScript's built in Map type.

Sealed

This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.

Signature​

/** @sealed */
export interface FluidMap<K, V> extends FluidReadonlyMap<K, V>

Extends: FluidReadonlyMap<K, V>

Type Parameters​

ParameterDescription
K
V

Methods​

MethodReturn TypeDescription
delete(key)voidRemoves the specified element from the map by its key.
forEach(callbackfn, thisArg)voidExecutes the provided function once per each key/value pair in the map.
set(key, value)voidAdds 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.

Method Details​

delete​

Removes the specified element from the map by its key.

Signature​

delete(key: K): void;

Remarks​

Unlike the built-in Map.delete, this returns void instead of a boolean. This is intentional: in a distributed system, the caller often cannot reliably know whether the element existed at the time of deletion. Subtypes may override this to return a boolean if appropriate.

Parameters​

ParameterTypeDescription
keyK

forEach​

Executes the provided function once per each key/value pair in the map.

Signature​

forEach(callbackfn: (value: V, key: K, map: FluidMap<K, V>) => void, thisArg?: any): void;

Parameters​

ParameterModifiersTypeDescription
callbackfn(value: V, key: K, map: FluidMap<K, V>) => void
thisArgoptionalany

set​

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.

Signature​

set(key: K, value: V): void;

Parameters​

ParameterTypeDescription
keyK
valueV