Skip to content

Commit 4931201

Browse files
committed
fix: only set state in listeners when provided
1 parent 7d85074 commit 4931201

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/core/focusManager.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ class FocusManager extends Subscribable {
1818
this.removeEventListener()
1919
}
2020
this.removeEventListener = setup((focused?: boolean) => {
21-
this.setFocused(focused)
21+
if (typeof focused === 'boolean') {
22+
this.setFocused(focused)
23+
} else {
24+
this.onFocus()
25+
}
2226
})
2327
}
2428

src/core/onlineManager.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ class OnlineManager extends Subscribable {
1818
this.removeEventListener()
1919
}
2020
this.removeEventListener = setup((online?: boolean) => {
21-
this.setOnline(online)
21+
if (typeof online === 'boolean') {
22+
this.setOnline(online)
23+
} else {
24+
this.onOnline()
25+
}
2226
})
2327
}
2428

0 commit comments

Comments
 (0)