1.0.1 • Published 8 years ago

react-screen-onresize-mixin v1.0.1

Weekly downloads
3
License
WTFPL
Repository
github
Last release
8 years ago

React screen resize listener mixin

A simple React mixin who handle screen resize detection from your React components.

Installation

npm install react-screen-onresize-mixin --save

Usage

// Import the mixin
import ScreenResizeMixin from 'react-screen-onresize-mixin';

const MyComponent = React.createClass({
  mixins: [ ScreenResizeMixin ], // add it to your component

  onScreenResize() {
    // This function is executed
    // each time the window is resized
  }
});

By default the function onScreenResize is executed after a delay of 250ms without resizing to prevent so many calls. This delay can be changed :

mixins: [ ScreenResizeMixin.delay( 500 ) ]