Skip to content

Class: ObservableMap<K, V> ​

Defined in: mobx:

See ​

https://mobx.js.org/README.html

Type Parameters ​

Type ParameterDefault type
Kany
Vany

Implements ​

Accessors ​

[toStringTag] ​

Get Signature ​

ts
get toStringTag: string;

Defined in: mobx:

Returns ​

string

Implementation of ​

ts
Map.[toStringTag]

size ​

Get Signature ​

ts
get size(): number;

Defined in: mobx:

Returns ​

number

the number of elements in the Map.

Implementation of ​

ts
Map.size

Constructors ​

Constructor ​

ts
new ObservableMap<K, V>(
   initialData?: IObservableMapInitialValues<K, V>, 
   enhancer_?: IEnhancer<V>, 
name_?: string): ObservableMap<K, V>;

Defined in: mobx:

Parameters ​

ParameterType
initialData?IObservableMapInitialValues<K, V>
enhancer_?IEnhancer<V>
name_?string

Returns ​

ObservableMap<K, V>

Methods ​

[iterator]() ​

ts
iterator: MapIterator<IMapEntry<K, V>>;

Defined in: mobx:

Returns ​

MapIterator<IMapEntry<K, V>>

Implementation of ​

ts
Map.[iterator]

clear() ​

ts
clear(): void;

Defined in: mobx:

Removes all elements from the Map.

Returns ​

void

Implementation of ​

ts
Map.clear

delete() ​

ts
delete(key: K): boolean;

Defined in: mobx:

Parameters ​

ParameterType
keyK

Returns ​

boolean

true if an element in the Map existed and has been removed, or false if the element does not exist.

Implementation of ​

ts
Map.delete

entries() ​

ts
entries(): MapIterator<IMapEntry<K, V>>;

Defined in: mobx:

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

Returns ​

MapIterator<IMapEntry<K, V>>

Implementation of ​

ts
Map.entries

forEach() ​

ts
forEach(callback: (value: V, key: K, object: Map<K, V>) => void, thisArg?: any): void;

Defined in: mobx:

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

Parameters ​

ParameterType
callback(value: V, key: K, object: Map<K, V>) => void
thisArg?any

Returns ​

void

Implementation of ​

ts
Map.forEach

get() ​

ts
get(key: K): V | undefined;

Defined in: mobx:

Returns a specified element from the Map object. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.

Parameters ​

ParameterType
keyK

Returns ​

V | undefined

Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.

Implementation of ​

ts
Map.get

getOrInsert() ​

ts
getOrInsert(key: K, value: V): V;

Defined in: mobx:

Parameters ​

ParameterType
keyK
valueV

Returns ​

V


getOrInsertComputed() ​

ts
getOrInsertComputed(key: K, callback: (key: K) => V): V;

Defined in: mobx:

Parameters ​

ParameterType
keyK
callback(key: K) => V

Returns ​

V


has() ​

ts
has(key: K): boolean;

Defined in: mobx:

Parameters ​

ParameterType
keyK

Returns ​

boolean

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

Implementation of ​

ts
Map.has

intercept_() ​

ts
intercept_(handler: IInterceptor<IMapWillChange<K, V>>): Lambda;

Defined in: mobx:

Parameters ​

ParameterType
handlerIInterceptor<IMapWillChange<K, V>>

Returns ​

Lambda


keys() ​

ts
keys(): MapIterator<K>;

Defined in: mobx:

Returns an iterable of keys in the map

Returns ​

MapIterator<K>

Implementation of ​

ts
Map.keys

merge() ​

ts
merge(other?: IObservableMapInitialValues<K, V>): ObservableMap<K, V>;

Defined in: mobx:

Merge another object into this object, returns this.

Parameters ​

ParameterType
other?IObservableMapInitialValues<K, V>

Returns ​

ObservableMap<K, V>


observe_() ​

ts
observe_(listener: (changes: IMapDidChange<K, V>) => void, fireImmediately?: boolean): Lambda;

Defined in: mobx:

Observes this object. Triggers for the events 'add', 'update' and 'delete'. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe for callback details

Parameters ​

ParameterType
listener(changes: IMapDidChange<K, V>) => void
fireImmediately?boolean

Returns ​

Lambda


replace() ​

ts
replace(values: IObservableMapInitialValues<K, V>): ObservableMap<K, V>;

Defined in: mobx:

Parameters ​

ParameterType
valuesIObservableMapInitialValues<K, V>

Returns ​

ObservableMap<K, V>


set() ​

ts
set(key: K, value: V): this;

Defined in: mobx:

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.

Parameters ​

ParameterType
keyK
valueV

Returns ​

this

Implementation of ​

ts
Map.set

toJSON() ​

ts
toJSON(): [K, V][];

Defined in: mobx:

Returns ​

[K, V][]


toString() ​

ts
toString(): string;

Defined in: mobx:

Returns a string representation of an object.

Returns ​

string


values() ​

ts
values(): MapIterator<V>;

Defined in: mobx:

Returns an iterable of values in the map

Returns ​

MapIterator<V>

Implementation of ​

ts
Map.values

Properties ​

[$mobx] ​

ts
[$mobx]: {
};

Defined in: mobx:


changeListeners_ ​

ts
changeListeners_: any;

Defined in: mobx:

Implementation of ​

IListenable.changeListeners_


data_ ​

ts
data_: Map<K, ObservableValue<V>>;

Defined in: mobx:


dehancer ​

ts
dehancer: any;

Defined in: mobx:


enhancer_ ​

ts
enhancer_: IEnhancer<V>;

Defined in: mobx:


hasMap_ ​

ts
hasMap_: Map<K, ObservableValue<boolean>>;

Defined in: mobx:


interceptors_ ​

ts
interceptors_: any;

Defined in: mobx:

Implementation of ​

IInterceptable.interceptors_


keysAtom_ ​

ts
keysAtom_: IAtom;

Defined in: mobx:


name_ ​

ts
name_: string;

Defined in: mobx: