Sha256: b24c126b198af525e11033d0ef41b4d8eccd0b3db884738e1ae9fc0f2db7bc8e

Contents?: true

Size: 478 Bytes

Versions: 5

Compression:

Stored size: 478 Bytes

Contents

export default function () {
  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

5 entries across 5 versions & 1 rubygems

Version Path
lookbook-0.2.4 app/assets/lookbook/js/size_observer.js
lookbook-0.2.3 app/assets/lookbook/js/size_observer.js
lookbook-0.2.2 app/assets/lookbook/js/size_observer.js
lookbook-0.2.1 app/assets/lookbook/js/size_observer.js
lookbook-0.2.0 app/assets/lookbook/js/size_observer.js