Sha256: 1aeaee8a34263881dea1c921bee899f2418ac1f6083d7c6ea3924bf221ac5e8b
Contents?: true
Size: 687 Bytes
Versions: 1
Compression:
Stored size: 687 Bytes
Contents
import { observeSize } from "@helpers/layout"; export default function dimensionsDisplayComponent(targetSelector) { return { width: 0, height: 0, resizing: false, init() { const target = document.querySelector(targetSelector); this.width = Math.round(target.clientWidth); this.height = Math.round(target.clientHeight); this.createObserver(); }, createObserver() { this.observer = observeSize( document.querySelector(targetSelector), ({ width, height }) => { this.width = width; this.height = height; } ); }, tearDown() { this.observer.disconnect(); }, }; }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lookbook-1.0.0.beta.0 | app/components/lookbook/dimensions_display/component.js |