261008_02_ENH: 사용가능 변수 리스트 노출 및 경고문 위치 수정, 추가

This commit is contained in:
2026-10-08 12:11:09 +09:00
parent 264707ac56
commit ea81777a24
2 changed files with 35 additions and 4 deletions

View File

@@ -43,12 +43,30 @@ export function useCtiConnection() {
// 뒤로/앞으로 가기로 bfcache에 들어갔다가 돌아오면 React 상태가 그대로 복원되어 위 effect가 다시 실행되지 않는다.
// 떠날 때 CTI 서버에 Logout, 돌아올 때 다시 Login 하여 새로고침 없이 전화걸기를 쓸 수 있게 한다.
useEffect(() => {
// TEMP_CTI_LOG: pagehide 시점 로그가 콘솔에 남지 않아, 떠날 때 정보를 sessionStorage에 남기고 돌아오거나 다시 로드될 때 출력한다.
const PAGEHIDE_DEBUG_KEY = "__cti_pagehide_debug"; // TEMP_CTI_LOG
const printLastPageHide = (from: string) => {
const saved = sessionStorage.getItem(PAGEHIDE_DEBUG_KEY);
if (!saved) return;
console.log(`[CTI][TEMP_LOG] last pagehide (${from}) ->`, JSON.parse(saved)); // TEMP_CTI_LOG
sessionStorage.removeItem(PAGEHIDE_DEBUG_KEY);
};
printLastPageHide("mount");
console.log("[CTI][TEMP_LOG] page lifecycle listeners registered"); // TEMP_CTI_LOG
const handlePageHide = (event: PageTransitionEvent) => {
console.log("[CTI][TEMP_LOG] pagehide, persisted =", event.persisted); // TEMP_CTI_LOG
sessionStorage.setItem(PAGEHIDE_DEBUG_KEY, JSON.stringify({
persisted: event.persisted,
at: new Date().toISOString(),
path: window.location.pathname,
connectionState: ctiClient.getConnectionState(),
})); // TEMP_CTI_LOG
if (event.persisted) ctiClient.suspendForPageHide();
};
const handlePageShow = (event: PageTransitionEvent) => {
console.log("[CTI][TEMP_LOG] pageshow, persisted =", event.persisted); // TEMP_CTI_LOG
printLastPageHide("pageshow");
if (event.persisted) ctiClient.resumeFromPageShow();
};