Skip to content 

ISharedMap Interface

Packages > @fluidframework/map > ISharedMap

Shared map interface

Signature:

export interface ISharedMap extends ISharedObject<ISharedMapEvents>, Map<string, any> 

Extends: ISharedObject<ISharedMapEvents>, Map<string, any>

Methods

List of methods of this class
Method Description
get(key) Retrieves the given key from the map.
set(key, value) Sets the value stored at key to the provided value.
wait(key) A form of get except it will only resolve the promise once the key exists in the map.

Methods

get

Retrieves the given key from the map.

Signature:

get<T = any>(key: string): T;

Parameters

List of parameters
Parameter Type Description
key string Key to retrieve from

Returns:

T

The stored value, or undefined if the key is not set

set

Sets the value stored at key to the provided value.

Signature:

set<T = any>(key: string, value: T): this;

Parameters

List of parameters
Parameter Type Description
key string Key to set at
value T Value to set

Returns:

this

The ISharedMap itself

wait

A form of get except it will only resolve the promise once the key exists in the map.

Signature:

wait<T = any>(key: string): Promise<T>;

Parameters

List of parameters
Parameter Type Description
key string Key to retrieve from

Returns:

Promise<T>

The stored value once available