Commit 9fbc02a
Move all properties of EventTarget to symbols to avoid polluting the global scope (#48962)
Summary:
Pull Request resolved: #48962
Changelog: [internal]
We moved away from private fields for `EventTarget` for performance, in favor of normal fields prefixed with underscore, but this would pollute the global scope when we make it extend `EventTarget`.
This refactors the implementation to use symbols for all properties to avoid that problem, leaving only `addEventListener` and `removeEventListener` as regular properties in the prototype.
Performance-wise this is neutral or a slight improvement according to the existing benchmark.
Reviewed By: javache
Differential Revision: D68672215
fbshipit-source-id: b329548efce6059ae2b9f33afa0719e057d3b8ba1 parent b28ab79 commit 9fbc02a
File tree
1 file changed
+185
-171
lines changed- packages/react-native/src/private/webapis/dom/events
1 file changed
+185
-171
lines changed
0 commit comments