# all files / candela/VisComponent/mixin/ Resize.js

82.86% Statements 29/35
100% Branches 23/23
62.5% Functions 5/8
63.64% Lines 7/11
16 statements, 4 functions, 20 branches Ignored

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    181×
    1×
    1×

    1×
    1×

    1×

     import 'javascript-detect-element-resize/detect-element-resize';
    import Events from './Events';
    import { getElementSize } from '../../util';

    let Resize = Base => class extends Events(Base) {
      constructor (...args) {
        super(...args);

        window.addResizeListener(this.el, () => {
          const size = getElementSize(this.el);
          this.emit('resize', size.width, size.height, this);
        });
      }
    };

    export default Resize;