diff --git a/common.gypi b/common.gypi index 33b1325eb513ea..4745bb5ac77639 100644 --- a/common.gypi +++ b/common.gypi @@ -36,7 +36,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.16', + 'v8_embedder_string': '-node.17', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index 0991d0ab6e4132..261d3b3f06064d 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -5020,6 +5020,13 @@ class V8_EXPORT BackingStore : public v8::internal::BackingStoreBase { */ bool IsShared() const; + /** + * Prevent implicit instantiation of operator delete with size_t argument. + * The size_t argument would be incorrect because ptr points to the + * internal BackingStore object. + */ + void operator delete(void* ptr) { ::operator delete(ptr); } + /** * Wrapper around ArrayBuffer::Allocator::Reallocate that preserves IsShared. * Assumes that the backing_store was allocated by the ArrayBuffer allocator diff --git a/doc/api/events.md b/doc/api/events.md index 17420a249be731..b593cfac44969f 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -829,6 +829,40 @@ class MyClass extends EventEmitter { } ``` +## `events.getEventListeners(emitterOrTarget, eventName)` + +* `emitterOrTarget` {EventEmitter|EventTarget} +* `eventName` {string|symbol} +* Returns: {Function[]} + +Returns a copy of the array of listeners for the event named `eventName`. + +For `EventEmitter`s this behaves exactly the same as calling `.listeners` on +the emitter. + +For `EventTarget`s this is the only way to get the event listeners for the +event target. This is useful for debugging and diagnostic purposes. + +```js +const { getEventListeners, EventEmitter } = require('events'); + +{ + const ee = new EventEmitter(); + const listener = () => console.log('Events are fun'); + ee.on('foo', listener); + getEventListeners(ee, 'foo'); // [listener] +} +{ + const et = new EventTarget(); + const listener = () => console.log('Events are fun'); + ee.addEventListener('foo', listener); + getEventListeners(ee, 'foo'); // [listener] +} +``` + ## `events.once(emitter, name[, options])`