Sha256: 87cba3a8018b4179b714a6391664e3b23bf133c09c4b94e6534a3160065e8191

Contents?: true

Size: 442 Bytes

Versions: 35

Compression:

Stored size: 442 Bytes

Contents

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

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
lookbook-0.9.8 app/assets/lookbook/js/components/sizes.js
lookbook-0.9.7 app/assets/lookbook/js/components/sizes.js
lookbook-0.9.6 app/assets/lookbook/js/components/sizes.js
lookbook-0.9.5 app/assets/lookbook/js/components/sizes.js
lookbook-0.9.4 app/assets/lookbook/js/components/sizes.js
lookbook-0.9.3 app/assets/lookbook/js/components/sizes.js
lookbook-0.9.2 app/assets/lookbook/js/components/sizes.js
lookbook-0.9.1 app/assets/lookbook/js/components/sizes.js
lookbook-0.9.0 app/assets/lookbook/js/components/sizes.js
lookbook-0.8.3 app/assets/lookbook/js/components/sizes.js
lookbook-0.8.2 app/assets/lookbook/js/components/sizes.js
lookbook-0.8.1 app/assets/lookbook/js/components/sizes.js
lookbook-0.8.0 app/assets/lookbook/js/components/sizes.js
lookbook-0.8.0.beta.0 app/assets/lookbook/js/components/sizes.js
lookbook-0.7.4 app/assets/lookbook/js/components/sizes.js
lookbook-0.7.3 app/assets/lookbook/js/components/sizes.js
lookbook-0.7.2 app/assets/lookbook/js/components/sizes.js
lookbook-0.7.2.beta.5 app/assets/lookbook/js/components/sizes.js
lookbook-0.7.2.beta.4 app/assets/lookbook/js/components/sizes.js
lookbook-0.7.2.beta.3 app/assets/lookbook/js/components/sizes.js