Skip to main content

FluidMap Interface

Like TypeScript's built in Map type.

This API is provided as a beta preview and may change without notice.

To use, import via fluid-framework/beta.

For more information about our API support guarantees, see here.

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

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

This API is provided as a beta preview and may change without notice.

For more information about our API support guarantees, see here.

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.

This API is provided as a beta preview and may change without notice.

For more information about our API support guarantees, see here.

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.

This API is provided as a beta preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

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

Parameters

ParameterTypeDescription
keyK
valueV