A wrapper around a regular Map, but one that fires events when data changes.
Events:
Adds one or more items to map
Can add items in the form of [key,value] or {key, value}.
{key, value}
map.set(`hello`, `samantha`);map.add([`hello`, `samantha`]);map.add({key: `hello`, value: `samantha`}) Copy
map.set(`hello`, `samantha`);map.add([`hello`, `samantha`]);map.add({key: `hello`, value: `samantha`})
Adds event listener.
Events
Event name
Event handler
Error if emitter is disposed
Clears map
Deletes an item by key
Iterates over entries (consisting of [key,value])
for (const [key, value] of map.entries()) { // Use key, value...} Copy
for (const [key, value] of map.entries()) { // Use key, value...}
Protected
Fire event
Type of event
Arguments for event
Gets an item by key
const item = map.get(`hello`); Copy
const item = map.get(`hello`);
Returns true if map contains key
if (map.has(`hello`)) ... Copy
if (map.has(`hello`)) ...
Returns true if map is empty
Remove event listener
Sets a value to a specified key
A wrapper around a regular Map, but one that fires events when data changes.
Events: