Sha256: 82ab548c174a61833e5ad4ac2b64ec5df69a8ac888c699182469ded9bee4ca62

Contents?: true

Size: 490 Bytes

Versions: 17

Compression:

Stored size: 490 Bytes

Contents

export default function sizeObserver() {
  return {
    observedWidth: 0,
    observedHeight: 0,
    init() {
      const ro = new ResizeObserver((entries) => {
        const rect = entries[0].contentRect;
        this.observedWidth = Math.round(rect.width);
        this.observedHeight = Math.round(rect.height);
      });
      ro.observe(this.$el);
      this.observedWidth = Math.round(this.$el.clientWidth);
      this.observedHeight = Math.round(this.$el.clientHeight);
    },
  };
}

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
lookbook-0.4.6 app/assets/lookbook/js/utils/size_observer.js
lookbook-0.4.5 app/assets/lookbook/js/utils/size_observer.js
lookbook-0.4.4 app/assets/lookbook/js/utils/size_observer.js
lookbook-0.4.3 app/assets/lookbook/js/utils/size_observer.js
lookbook-0.4.2 app/assets/lookbook/js/utils/size_observer.js
lookbook-0.4.1 app/assets/lookbook/js/utils/size_observer.js
lookbook-0.3.5 app/assets/lookbook/js/utils/size_observer.js
lookbook-0.4.0.beta.2 app/assets/lookbook/js/utils/size_observer.js
lookbook-0.4.0.beta.1 app/assets/lookbook/js/utils/size_observer.js
lookbook-0.3.4 app/assets/lookbook/js/utils/size_observer.js
lookbook-0.3.3 app/assets/lookbook/js/utils/size_observer.js
lookbook-0.3.2 app/assets/lookbook/js/utils/size_observer.js
lookbook-0.3.1 app/assets/lookbook/js/utils/size_observer.js
lookbook-0.3.0 app/assets/lookbook/js/utils/size_observer.js
lookbook-0.3.0.beta.2 app/assets/lookbook/js/utils/size_observer.js
lookbook-0.3.0.beta.1 app/assets/lookbook/js/utils/size_observer.js
lookbook-0.3.0.beta.0 app/assets/lookbook/js/utils/size_observer.js