JavaScript

[JavaScript & window] 자식창이 종료되었는지 확인

IT공부블로그 2019. 6. 13. 20:04
728x90
반응형

let closeWindowCheck = windowObj => {

// 0.5초 마다 감지

    g_oInterval = window.setInterval(function() {

        try {

            // 창이 꺼졌는지 판단

            if( windowObj == null || windowObj.closed ) {

                window.clearInterval(g_oInterval);

                windowObj = null;

                // Todo....

                //.....

                console.log("창꺼짐");

                search(compName, workStatus, kwd, 'true');

       

            }

        } catch (e) { }

    }, 500);

 };

windowObj는  windowObj = window.open('', '', ''); 이다

자식창이 종료되었는지 확인하면서 창이 종료되면 특정 작업을 수행할때 사용

728x90
반응형