Created
January 17, 2020 05:10
-
-
Save irrationnelle/ec3cc48f4ab66aef2806a5eb95490377 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const imgArray = [img1, img2, img3]; | |
// 이 함수는 이미지 크기나 종류에 따라 각기 다른 연산 시간을 가지는 작업을 하는 | |
// Promise 를 리턴한다. | |
function asyncFun(img) { | |
return new Promise((resolve) => { | |
setTimeout(() => { | |
resolve(img) | |
}, getRandomArbitrary(100, 1000)); | |
}); | |
} | |
// 이 함수는 min과 max 사이의 랜덤값을 반환한다 | |
function getRandomArbitrary(min, max) { | |
return Math.random() * (max - min) + min; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment