Skip to content

Commit 134443d

Browse files
josephschmittmarcj
authored andcommitted
Fix ElementQueries always attaching to window and listening (#162)
When we originally added UMD support, we forgot to move the logic that forcibly calls .listen() out of the block at the bottom and into the UMD logic block. This, in turn, meant that EQ was always being attached to window and listen was always being called, even when using EQ or ResizeSensor in a front-end environment with module support.
1 parent c444bc4 commit 134443d

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/ElementQueries.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
module.exports = factory(require('./ResizeSensor.js'));
1212
} else {
1313
root.ElementQueries = factory(root.ResizeSensor);
14+
root.ElementQueries.listen();
1415
}
1516
}(this, function (ResizeSensor) {
1617

@@ -501,15 +502,6 @@
501502
domLoaded(ElementQueries.init);
502503
};
503504

504-
// make available to common module loader
505-
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
506-
module.exports = ElementQueries;
507-
}
508-
else {
509-
window.ElementQueries = ElementQueries;
510-
ElementQueries.listen();
511-
}
512-
513505
return ElementQueries;
514506

515507
}));

0 commit comments

Comments
 (0)