In
Some development scenarios, we may inject thousands of nodes into the document at once, and in a short time the large number of DOM nodes in the browser may be too much for the browser, the result will often make the browser lag or unbearable, one of the solutions is to use the Tick function (timechunk).
The Timechunk function makes the creation of nodes work in batches, such as creating 1000 nodes in a second and creating 10 nodes per 200ms instead. The specific Timechunk function is encapsulated as follows
functionTimechunk (arr, FN, count) {//arr array fn action function count per operation quantity varobj, t; varStart =function(){ varLen = math.min (count| | 1, arr.length); for(vari=0; i < Len; i++) {obj=Arr.shift (); fn (obj)}}; return function(interval) {t= SetInterval (function(){ if(arr.length==0){ returnclearinterval (t)}; Start (); },interval|| 200) }}
Application examples See https://92node.com/article/js-fen-shi.html
The time function of JavaScript