()
| 136 | |
| 137 | // 初始化 |
| 138 | function init() { |
| 139 | createProgressRing(); |
| 140 | const throttledUpdate = throttle(updateProgress, 100); |
| 141 | const throttledResize = throttle(() => { |
| 142 | updateCircleSize(); |
| 143 | updateProgress(); |
| 144 | }, 200); |
| 145 | |
| 146 | window.addEventListener('scroll', throttledUpdate, { passive: true }); |
| 147 | window.addEventListener('resize', throttledResize, { passive: true }); |
| 148 | updateProgress(); |
| 149 | } |
| 150 | |
| 151 | if (document.readyState === 'loading') { |
| 152 | document.addEventListener('DOMContentLoaded', init); |
no test coverage detected