FluidMap Interface
Like TypeScript's built in Map type.
To use, import via fluid-framework/beta.
For more information about our API support guarantees, see here.
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
| Parameter | Description |
|---|---|
| K | |
| V |
Methods
| Method | Alerts | Return Type | Description |
|---|---|---|---|
| delete(key) | Beta | void | Removes the specified element from the map by its key. |
| forEach(callbackfn, thisArg) | Beta | void | Executes the provided function once per each key/value pair in the map. |
| set(key, value) | Beta | void | 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. |
Method Details
delete
Removes the specified element from the map by its key.
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
| Parameter | Type | Description |
|---|---|---|
| key | K |
forEach
Executes the provided function once per each key/value pair in the map.
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
| Parameter | Modifiers | Type | Description |
|---|---|---|---|
| callbackfn | (value: V, key: K, map: FluidMap<K, V>) => void | ||
| thisArg | optional | any |
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.
For more information about our API support guarantees, see here.
Signature
set(key: K, value: V): void;
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | K | |
| value | V |