MCPcopy Create free account
hub / github.com/NCUSCC/cs4ncu / throttle

Function throttle

docs/javascripts/readingProgress.js:126–135  ·  view source on GitHub ↗
(func, limit)

Source from the content-addressed store, hash-verified

124
125 // 节流函数
126 function throttle(func, limit) {
127 let inThrottle;
128 return function() {
129 if (!inThrottle) {
130 func.apply(this, arguments);
131 inThrottle = true;
132 setTimeout(() => inThrottle = false, limit);
133 }
134 }
135 }
136
137 // 初始化
138 function init() {

Callers 1

initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected