1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function fnInput() {
    const promise = new Promise(function (resolve, reject) {
        //fnLoadingOpen(); // 로딩 시작
 
        // 로딩 이미지가 활성화 된 상태에서 실행하기 위해 지연시간을 둠
        setTimeout(function () {
            resolve();
        }, 100);
    });
 
    promise.then(function () {
        // 처리
        //....................
 
        //return 리턴값; // 리턴값 있을 경우 사용
   }).then(function(value) { // 이전단계에서 처리 후 리턴값을 보냈으면 받아서 처리
        //fnLoadingClose(); // 로딩 종료
    });
}
 
/****************************************/
IE에서 Promise가 지원 안되기 때문에 
 
html head에 script 추가
 
 
    if (typeof Promise !== "function") {
        document.write('<script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.5/bluebird.min.js"><\/script>');
    }
 
 
추가
cs

+ Recent posts