Skip to content

Commit afcb66b

Browse files
committed
fix: focus handler typings
Typings did not allow passing a function taking `setFocused` to addEventListener Fixing by using the same typings as in `onlineManager.ts`, tweaked to allow default Window.Event behavior
1 parent c343457 commit afcb66b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/core/focusManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ class FocusManager extends Subscribable {
1212
}
1313

1414
setEventListener(
15-
setup: (onFocus: () => void) => (focused?: boolean) => void
15+
setup: (setFocused: (focused: boolean | Event) => void) => () => void
1616
): void {
1717
if (this.removeEventListener) {
1818
this.removeEventListener()
1919
}
20-
this.removeEventListener = setup((focused?: boolean) => {
20+
this.removeEventListener = setup((focused) => {
2121
if (typeof focused === 'boolean') {
2222
this.setFocused(focused)
2323
} else {

0 commit comments

Comments
 (0)