소스 검색

fix: electron api

Timothy Jaeryang Baek 4 달 전
부모
커밋
ce1712fed1
1개의 변경된 파일8개의 추가작업 그리고 2개의 파일을 삭제
  1. 8 2
      src/routes/+layout.svelte

+ 8 - 2
src/routes/+layout.svelte

@@ -105,9 +105,12 @@
 
 		let isFocused = document.visibilityState !== 'visible';
 		if (window.electronAPI) {
-			isFocused = await window.electronAPI.send({
+			const res = await window.electronAPI.send({
 				type: 'window:isFocused'
 			});
+			if (res) {
+				isFocused = res.isFocused;
+			}
 		}
 
 		if ((event.chat_id !== $chatId && !$temporaryChatEnabled) || isFocused) {
@@ -155,9 +158,12 @@
 
 		let isFocused = document.visibilityState !== 'visible';
 		if (window.electronAPI) {
-			isFocused = await window.electronAPI.send({
+			const res = await window.electronAPI.send({
 				type: 'window:isFocused'
 			});
+			if (res) {
+				isFocused = res.isFocused;
+			}
 		}
 
 		if ((!channel || isFocused) && event?.user?.id !== $user?.id) {