Skip to content

Commit 1e60c46

Browse files
committed
Short-circuit if ResizeObserverEntry is undefined
1 parent 04032f3 commit 1e60c46

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/findBreakpoint.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ import { Breakpoints } from './Breakpoints';
1616
* // matchedValue => 'desktop'
1717
*
1818
*/
19-
export const findBreakpoint = (breakpoints: Breakpoints, observedSize: number): any => {
19+
export const findBreakpoint = (breakpoints: Breakpoints, observedSize?: number): any => {
20+
if (typeof observedSize === 'undefined') return undefined;
21+
2022
let breakpoint: number | undefined;
2123
const sizes = Object.keys(breakpoints).map(key => Number(key));
2224

0 commit comments

Comments
 (0)