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.7.2.beta.2 app/assets/lookbook/js/components/sizes.js
lookbook-0.7.2.beta.1 app/assets/lookbook/js/components/sizes.js
lookbook-0.7.2.beta.0 app/assets/lookbook/js/components/sizes.js
lookbook-0.7.1 app/assets/lookbook/js/components/sizes.js
lookbook-0.7.0 app/assets/lookbook/js/components/sizes.js
lookbook-0.6.1 app/assets/lookbook/js/components/sizes.js
lookbook-0.6.0 app/assets/lookbook/js/components/sizes.js
lookbook-0.5.2 app/assets/lookbook/js/components/sizes.js
lookbook-0.5.1 app/assets/lookbook/js/components/sizes.js
lookbook-0.5.0 app/assets/lookbook/js/components/sizes.js
lookbook-0.5.0.beta.2 app/assets/lookbook/js/components/sizes.js
lookbook-0.5.0.beta.1 app/assets/lookbook/js/components/sizes.js
lookbook-0.5.0.beta.0 app/assets/lookbook/js/components/sizes.js
lookbook-0.4.8 app/assets/lookbook/js/components/sizes.js
lookbook-0.4.7 app/assets/lookbook/js/components/sizes.js