새소식

Library/🥏 jQuery

[jquery] setTimeout을 사용하여 여러 파일 다운로드 하기

  • -
728x90

🔥 Problem

👉 여러 파일을 다운로드하는 기능을 구현할 필요가 생겼습니다.

🧙 Solution

👉 프로젝트마다 파일 다운로드를 하는 함수 있으시죠?

아래에 공개한 코드를 참고하셔서 응용하시면 됩니다. 참고로 대국민 시스템에도 들어간 로직... = ㅅ =

어쨌든 1초에 한번씩 다운로드 함수를 호출하자는 아이디어입니다.

for(var i = 0; i < data.length; i++){
  (function(t){
    setTimeout(function(){
      console.log("다운로드 함수 로직 구현 ")
      console.log("t : " +t)
    }, 1000*t);
  })(i);
}

If I was of any help to you, please buy me coffee 😿😢😥

If you have any questions, please leave them in the comments

🧭 References

[1] reference : https://doctorson0309.tistory.com/

[2] Ads : https://play.google.com/store/apps/details?id=io.cordova.seoulfilter

반응형

'Library > 🥏 jQuery' 카테고리의 다른 글

[jQuery] ajax body에 json 담는 방법  (0) 2023.09.18
Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.