Skip to content

thalesrc/resize-manager

Repository files navigation

@thalesrc/resize-manager

Rxjs Based Resize Events of Window & Dom Elements

npm npm npm ts patreon

Installation

npm install @thalesrc/resize-manager --save

All Documentation => thalesrc.github.io/resize-manager

Basic Usage

import { ResizeObserver } from '@thalesrc/resize-manager';

const element = document.querySelector('foo');

const observer = new ResizeObserver(element);

observer.resize.subscribe(({width, height}) => {
  console.log(width, height);
});

or

import { ResizeManager } from '@thalesrc/resize-manager';

const element1 = document.querySelector('foo');
const element2 = document.querySelector('bar');

const manager = new ResizeManager();

manager.observe(element1).resize.subscribe(({width, height}) => {
  console.log(width, height);
});

manager.observe(element2).resize.subscribe(({width, height}) => {
  console.log(width, height);
});