JSPM

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

A React mixin that enable components to bind events

Package Exports

  • react-event-listener

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 (react-event-listener) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

React-Event-Listener npm version

A React mixin that enable components to bind events

Getting Started

Install via npm

npm install react-event-listener --save-dev

Usage

var React = require('react');
var EventListener = require('react-event-listener');

React.createClass({
  mixins: [EventListener],
  listeners: {
    window: {
      resize: 'onResize',
    },
    document: {
      mousemove: 'onMouseMove',
    },
  },
  onResize: function() {
    // the variable this refers to the window object
  },
  onMouseMove: function() {
    // the variable this refers to the document object
  },
});

License

MIT