Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental Event API: Remove "listener" from event objects #15391

Merged
merged 3 commits into from
Apr 12, 2019

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented Apr 11, 2019

This PR removes the logic for attaching a listener field to event objects, which leaks to the user function. Instead dispatchEvent now takes a listener argument instead. I also tidied up the resetting of current context values to avoid memory leaks and added an invariant to deal with edge cases at runtime.

invariant(
currentEventQueue && currentInstance,
'An event responder context was used outside of an event cycle. ' +
'Use context.setTimeout() to use asynchronous responder context outside of event cycle .',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@sizebot
Copy link

sizebot commented Apr 12, 2019

ReactDOM: size: 0.0%, gzip: 0.0%

Details of bundled changes.

Comparing: ed67984...9cb5ccc

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js +0.1% +0.1% 808.47 KB 809.01 KB 184.73 KB 184.87 KB UMD_DEV
react-dom.production.min.js 0.0% 0.0% 103.64 KB 103.68 KB 33.69 KB 33.69 KB UMD_PROD
react-dom.development.js +0.1% +0.1% 802.95 KB 803.5 KB 183.2 KB 183.33 KB NODE_DEV
react-dom.production.min.js 0.0% -0.0% 103.63 KB 103.67 KB 33.14 KB 33.14 KB NODE_PROD
react-dom-test-utils.development.js 0.0% -0.0% 54.19 KB 54.19 KB 14.98 KB 14.98 KB UMD_DEV
react-dom-test-utils.production.min.js 0.0% -0.1% 10.52 KB 10.52 KB 3.9 KB 3.89 KB UMD_PROD
react-dom-test-utils.development.js 0.0% -0.0% 53.91 KB 53.91 KB 14.91 KB 14.91 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% -0.0% 10.31 KB 10.31 KB 3.82 KB 3.82 KB NODE_PROD
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 60.76 KB 60.76 KB 15.85 KB 15.85 KB UMD_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.1% 10.69 KB 10.69 KB 3.67 KB 3.66 KB UMD_PROD
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 60.43 KB 60.43 KB 15.72 KB 15.72 KB NODE_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.1% 10.42 KB 10.42 KB 3.57 KB 3.56 KB NODE_PROD
react-dom-server.browser.development.js 0.0% -0.0% 136.73 KB 136.73 KB 35.92 KB 35.92 KB UMD_DEV
react-dom-server.browser.production.min.js 0.0% -0.0% 19.18 KB 19.18 KB 7.21 KB 7.21 KB UMD_PROD
react-dom-server.browser.development.js 0.0% -0.0% 132.86 KB 132.86 KB 34.99 KB 34.99 KB NODE_DEV
react-dom-server.browser.production.min.js 0.0% -0.0% 19.1 KB 19.1 KB 7.2 KB 7.2 KB NODE_PROD
react-dom-server.node.development.js 0.0% -0.0% 134.8 KB 134.8 KB 35.54 KB 35.53 KB NODE_DEV
react-dom-server.node.production.min.js 0.0% -0.0% 19.96 KB 19.96 KB 7.51 KB 7.51 KB NODE_PROD
ReactDOM-dev.js +0.1% +0.1% 827.07 KB 827.66 KB 184.44 KB 184.61 KB FB_WWW_DEV
ReactDOM-prod.js 🔺+0.1% -0.0% 335.8 KB 336 KB 62.54 KB 62.53 KB FB_WWW_PROD
ReactDOMServer-dev.js 0.0% -0.0% 134.95 KB 134.95 KB 34.61 KB 34.61 KB FB_WWW_DEV
ReactDOMServer-prod.js 0.0% 0.0% 47.14 KB 47.14 KB 10.8 KB 10.8 KB FB_WWW_PROD
react-dom.profiling.min.js 0.0% -0.0% 106.95 KB 107 KB 33.99 KB 33.99 KB NODE_PROFILING
ReactDOM-profiling.js +0.1% -0.0% 341.18 KB 341.38 KB 63.47 KB 63.46 KB FB_WWW_PROFILING
react-dom.profiling.min.js 0.0% 0.0% 106.79 KB 106.83 KB 34.64 KB 34.64 KB UMD_PROFILING
react-dom-unstable-fizz.browser.development.js 0.0% -0.1% 3.66 KB 3.66 KB 1.45 KB 1.45 KB UMD_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% -0.3% 1.21 KB 1.21 KB 707 B 705 B UMD_PROD
react-dom-unstable-fizz.browser.development.js 0.0% -0.1% 3.49 KB 3.49 KB 1.41 KB 1.41 KB NODE_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% -0.3% 1.05 KB 1.05 KB 638 B 636 B NODE_PROD
react-dom-unstable-fizz.node.development.js 0.0% -0.1% 3.74 KB 3.74 KB 1.43 KB 1.43 KB NODE_DEV
react-dom-unstable-fizz.node.production.min.js 0.0% -0.3% 1.1 KB 1.1 KB 668 B 666 B NODE_PROD
react-dom-unstable-fire.development.js +0.1% +0.1% 808.79 KB 809.34 KB 184.87 KB 185.01 KB UMD_DEV
react-dom-unstable-fire.production.min.js 0.0% 0.0% 103.65 KB 103.7 KB 33.69 KB 33.7 KB UMD_PROD
react-dom-unstable-fire.profiling.min.js 0.0% 0.0% 106.8 KB 106.85 KB 34.64 KB 34.65 KB UMD_PROFILING
react-dom-unstable-fire.development.js +0.1% +0.1% 803.27 KB 803.82 KB 183.33 KB 183.46 KB NODE_DEV
react-dom-unstable-fire.production.min.js 0.0% -0.0% 103.64 KB 103.69 KB 33.15 KB 33.15 KB NODE_PROD
react-dom-unstable-fire.profiling.min.js 0.0% -0.0% 106.97 KB 107.01 KB 34 KB 34 KB NODE_PROFILING
ReactFire-dev.js +0.1% +0.1% 826.26 KB 826.85 KB 184.5 KB 184.62 KB FB_WWW_DEV
ReactFire-prod.js 🔺+0.1% -0.0% 323.77 KB 323.97 KB 60.09 KB 60.08 KB FB_WWW_PROD
ReactFire-profiling.js +0.1% -0.0% 329.12 KB 329.32 KB 61.05 KB 61.04 KB FB_WWW_PROFILING

Generated by 🚫 dangerJS

@trueadm trueadm merged commit 543353a into facebook:master Apr 12, 2019
@trueadm trueadm deleted the move-listener-off-event-object branch April 12, 2019 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants