JSPM

detect-resize

0.1.5
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 282
  • Score
    100M100P100Q90129F
  • License MIT

Detect element resize in universal applications.

Package Exports

  • detect-resize

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (detect-resize) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

detect-resize

Slightly refactored version of https://github.com/sdecima/javascript-detect-element-resize targeting universal React applications. Will not throw if imported (ES6) on the server.

Build Status

NPM

Install

npm i -S detect-resize

How to use

Should work the same as javascript-detect-element-resize without throwing errors if used in a server environment.

import { addResizeListener, removeResizeListener } from 'detect-resize'

const resizeElement = document.getElementById('resizeElement'),
const handleResize = () => { console.info('resized') }

addResizeListener(resizeElement, handleResize)
removeResizeListener(resizeElement, handleResize)