Yielding Processes(배열 블록)
2352 단어 process
1 function chunk(array, process, context) {
2 setTimeout(function() {
3 var item = array.shift();
4 process.call(context, item);
5
6 if (array.length > 0) {
7 setTimeout(arguments.callee, 100);
8 }
9 }, 100);
10 }
11
12 var data = [12, 123, 1234, 453, 436, 23, 23, 5, 4123, 45, 346, 5634, 2234, 345, 342];
13
14 function printValue(item) {
15 var div = document.getElementById("myDiv");
16 div.innerHTML += item + " <br/> ";
17 }
18 chunk(data, printValue);
19 //
20 //chunk(data.concat(), printValue);
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
메모리 프로세스 보기 Powershell백분율로 메모리 사용량 얻기 상위 5개 프로세스 메모리 사용량(MB)...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.