Skip to content

Commit 1c1509d

Browse files
committed
2.2.0
1 parent de67cbc commit 1c1509d

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -965,11 +965,13 @@ Code related to measuring the size of the carousel after mounting
965965
// Add resize listening
966966
mounted: function () {
967967
this.onResize();
968-
return window.addEventListener('resize', this.onResize);
968+
// Resize observer listens for the element itself to change dimensions
969+
this.resizeObserver = new ResizeObserver(this.onResize);
970+
return this.resizeObserver.observe(this.$el);
969971
},
970-
// Cleanup listeners
971972
beforeDestroy: function () {
972-
return window.removeEventListener('resize', this.onResize);
973+
var ref;
974+
return (ref = this.resizeObserver) != null ? ref.disconnect() : void 0;
973975
},
974976
computed: {
975977
// The width of a page of slides, which may be less than the carouselWidth

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-ssr-carousel",
3-
"version": "2.1.0",
3+
"version": "2.2.0",
44
"description": "A performance focused Vue carousel designed for SSR/SSG environments.",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)