Some time ago, I saw a modular solution written by a friend on the Nuggets. Today, I also made one on my whim
The first post, writing is limited, technology is limited, please bear with me!
demo
The source address
To solve the problem
- Slow FPS due to too much content on the first screen
- Speed up the first screen loading
- Dynamically controls the first screen loading
Implementation approach
Use Windows. RequestAnimationFrame and document. ReadyState implementation component loading
Window. RequestAnimationFrame ensure the FPS when the load will not too low
Document. readyState gets the current DOM node loading state to ensure that the new node is rendered after the previous node is rendered
Supported functions
- Dynamic component props pass
- Dynamic component event listening
- Dynamic valence instance object acquisition
- Dynamic component destruction
- Dynamic components load asynchronously