Skip to content

Commit 2bb1134

Browse files
committed
Better, if a little OTT, backwards compatibility
1 parent d8474fd commit 2bb1134

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

obs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
refreshConnectionStatus();
169169

170170
// Listen out for network condition changes and rerun the function.
171-
if (observeChanges && connection?.addEventListener) {
171+
if (observeChanges && connection && typeof connection.addEventListener === 'function') {
172172
connection.addEventListener('change', refreshConnectionStatus);
173173
}
174174

0 commit comments

Comments
 (0)