Skip to content

Commit aa860ba

Browse files
author
Guillaume Chau
committedDec 21, 2018
chore: v0.4.5
1 parent c26cf15 commit aa860ba

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed
 

‎dist/vue-resize.esm.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function install(Vue) {
9696
// Plugin
9797
var plugin = {
9898
// eslint-disable-next-line no-undef
99-
version: "0.4.4",
99+
version: "0.4.5",
100100
install: install
101101
};
102102

‎dist/vue-resize.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/vue-resize.umd.js

+11-13
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,21 @@ var ResizeObserver = { render: function render() {
4545
name: 'resize-observer',
4646

4747
methods: {
48-
notify: function notify() {
49-
this.$emit('notify');
50-
},
51-
addResizeHandlers: function addResizeHandlers() {
52-
this._resizeObject.contentDocument.defaultView.addEventListener('resize', this.notify);
48+
compareAndNotify: function compareAndNotify() {
5349
if (this._w !== this.$el.offsetWidth || this._h !== this.$el.offsetHeight) {
54-
this.notify();
50+
this._w = this.$el.offsetWidth;
51+
this._h = this.$el.offsetHeight;
52+
this.$emit('notify');
5553
}
5654
},
55+
addResizeHandlers: function addResizeHandlers() {
56+
this._resizeObject.contentDocument.defaultView.addEventListener('resize', this.compareAndNotify);
57+
this.compareAndNotify();
58+
},
5759
removeResizeHandlers: function removeResizeHandlers() {
5860
if (this._resizeObject && this._resizeObject.onload) {
5961
if (!isIE && this._resizeObject.contentDocument) {
60-
this._resizeObject.contentDocument.defaultView.removeEventListener('resize', this.notify);
62+
this._resizeObject.contentDocument.defaultView.removeEventListener('resize', this.compareAndNotify);
6163
}
6264
delete this._resizeObject.onload;
6365
}
@@ -74,7 +76,6 @@ var ResizeObserver = { render: function render() {
7476
});
7577
var object = document.createElement('object');
7678
this._resizeObject = object;
77-
object.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;');
7879
object.setAttribute('aria-hidden', 'true');
7980
object.setAttribute('tabindex', -1);
8081
object.onload = this.addResizeHandlers;
@@ -95,16 +96,13 @@ var ResizeObserver = { render: function render() {
9596
// Install the components
9697
function install(Vue) {
9798
Vue.component('resize-observer', ResizeObserver);
98-
/* -- Add more components here -- */
99+
Vue.component('ResizeObserver', ResizeObserver);
99100
}
100101

101-
/* -- Plugin definition & Auto-install -- */
102-
/* You shouldn't have to modify the code below */
103-
104102
// Plugin
105103
var plugin = {
106104
// eslint-disable-next-line no-undef
107-
version: "0.4.4",
105+
version: "0.4.5",
108106
install: install
109107
};
110108

0 commit comments

Comments
 (0)
Please sign in to comment.