We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fea8c46 commit 678337aCopy full SHA for 678337a
src/index.ts
@@ -240,10 +240,16 @@ let mutations: MutationObserver | undefined
240
*/
241
let resize: ResizeObserver | undefined
242
243
+/**
244
+ * Ensure the browser is supported.
245
+ */
246
+const supportedBrowser =
247
+ typeof window !== "undefined" && "ResizeObserver" in window
248
+
249
/**
250
* If this is in a browser, initialize our Web APIs
251
-if (typeof window !== "undefined") {
252
+if (supportedBrowser) {
253
root = document.documentElement
254
mutations = new MutationObserver(handleMutations)
255
resize = new ResizeObserver(handleResizes)
0 commit comments