diff --git a/packages/react-native/Libraries/vendor/emitter/EventEmitter.js b/packages/react-native/Libraries/vendor/emitter/EventEmitter.js index 904b77a3226756..e638309de87fc8 100644 --- a/packages/react-native/Libraries/vendor/emitter/EventEmitter.js +++ b/packages/react-native/Libraries/vendor/emitter/EventEmitter.js @@ -63,7 +63,7 @@ type Registry = $ObjMap< export default class EventEmitter implements IEventEmitter { - _registry: Registry = {}; + #registry: Registry = {}; /** * Registers a listener that is called when the supplied event is emitted. @@ -83,7 +83,7 @@ export default class EventEmitter TEventToArgsMap, TEvent, TEventToArgsMap[TEvent], - >(this._registry, eventType); + >(this.#registry, eventType); const registration: Registration = { context, listener, @@ -107,7 +107,7 @@ export default class EventEmitter ...args: TEventToArgsMap[TEvent] ): void { const registrations: ?Set> = - this._registry[eventType]; + this.#registry[eventType]; if (registrations != null) { for (const registration of [...registrations]) { registration.listener.apply(registration.context, args); @@ -122,9 +122,9 @@ export default class EventEmitter eventType?: ?TEvent, ): void { if (eventType == null) { - this._registry = {}; + this.#registry = {}; } else { - delete this._registry[eventType]; + delete this.#registry[eventType]; } } @@ -132,7 +132,7 @@ export default class EventEmitter * Returns the number of registered listeners for the supplied event. */ listenerCount>(eventType: TEvent): number { - const registrations: ?Set> = this._registry[eventType]; + const registrations: ?Set> = this.#registry[eventType]; return registrations == null ? 0 : registrations.size; } }