-
Notifications
You must be signed in to change notification settings - Fork 37
refactor: Use channel to optimize render #32
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
raf(callback); | ||
} else { | ||
const channel = new MessageChannel(); | ||
channel.port1.onmessage = () => callback(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
channel.port1.onmessage = () => callback(); | |
channel.port1.onmessage = callback; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TS 会报错,所以包了一下。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
soga
Codecov Report
@@ Coverage Diff @@
## master #32 +/- ##
==========================================
- Coverage 99.50% 98.07% -1.44%
==========================================
Files 4 5 +1
Lines 203 208 +5
Branches 69 68 -1
==========================================
+ Hits 202 204 +2
- Misses 1 4 +3
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
使用 MessageChannel 使其批量更新在下一帧前,Resize 事件后。从而避免渲染时额外的跳动。需要多看看是否对使用有影响。
ref ant-design/ant-design#41374