mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-29 00:20:04 +01:00
web: try to reconnect sync on window focus
This commit is contained in:
committed by
Abdullah Atta
parent
abb89ecbc3
commit
1e5f13087b
@@ -35,7 +35,7 @@ function isDocumentHidden() {
|
||||
|
||||
export function onPageVisibilityChanged(
|
||||
handler: (
|
||||
status: "online" | "offline" | "visibilitychange",
|
||||
status: "online" | "offline" | "visibilitychange" | "focus",
|
||||
bool: boolean
|
||||
) => void
|
||||
) {
|
||||
@@ -46,6 +46,8 @@ export function onPageVisibilityChanged(
|
||||
document.addEventListener(visibilityChange(), () =>
|
||||
handler("visibilitychange", isDocumentHidden())
|
||||
);
|
||||
|
||||
window.addEventListener("focus", () => handler("focus", false));
|
||||
}
|
||||
|
||||
function onDeviceOnline(handler: () => void) {
|
||||
|
||||
Reference in New Issue
Block a user