The type of keys in the map
The type of values in the map
Readonly[toReadonlyeventsEvent emitter for map mutations
Alias for has(). Checks if a key exists in the map.
Alias for emitter.removeListener().
Adds the listener function to the end of the listeners array for the
event named eventName. No checks are made to see if the listener has
already been added. Multiple calls passing the same combination of eventName
and listener will result in the listener being added, and called, multiple
times.
server.on('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The
emitter.prependListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => console.log('a'));
myEE.prependListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
The name of the event.
The callback function
Adds a one-time listener function for the event named eventName. The
next time eventName is triggered, this listener is removed and then invoked.
server.once('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The
emitter.prependOnceListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.once('foo', () => console.log('a'));
myEE.prependOnceListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
The name of the event.
The callback function
ReadonlysizeStatic Readonly[species]Returns the value at the given index. Supports negative indices.
The index of the value to return
Copies a sequence of entries within the map.
Index to copy entries to
Index to start copying from
Optionalend: numberIndex to stop copying from (exclusive)
Fills entries with a value from start to end index.
Value to fill with
Start index (default: 0)
End index (default: size)
Flattens nested arrays in values to a specified depth.
Optionaldepth: DDepth level to flatten (default: 1)
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.
Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.
boolean indicating whether an element with the specified key exists or not.
Returns the first index of a value.
Value to search for
Index to start searching from (default: 0)
Joins all values into a string.
Separator between values (default: ',')
Returns an iterable of keys in the map
Returns the last index of a value.
Value to search for
Index to start searching backwards from
Reverses the order of entries in place.
Returns a locale-specific string representation of values.
Returns a string representation of values.
Returns an iterable of values in the map
Staticgroup
An extended Map with Array-like methods and event emission.