react-event-listener
Advanced tools
Comparing version 0.5.5 to 0.5.6
@@ -7,2 +7,10 @@ 'use strict'; | ||
var _classCallCheck = _interopDefault(require('@babel/runtime/helpers/builtin/classCallCheck')); | ||
var _inherits = _interopDefault(require('@babel/runtime/helpers/builtin/inherits')); | ||
var _createClass = _interopDefault(require('@babel/runtime/helpers/builtin/createClass')); | ||
var _possibleConstructorReturn = _interopDefault(require('@babel/runtime/helpers/builtin/possibleConstructorReturn')); | ||
var _getPrototypeOf = _interopDefault(require('@babel/runtime/helpers/builtin/getPrototypeOf')); | ||
var _typeof = _interopDefault(require('@babel/runtime/helpers/builtin/typeof')); | ||
var _objectWithoutProperties = _interopDefault(require('@babel/runtime/helpers/builtin/objectWithoutProperties')); | ||
var _extends = _interopDefault(require('@babel/runtime/helpers/builtin/extends')); | ||
var React = _interopDefault(require('react')); | ||
@@ -15,9 +23,8 @@ var PropTypes = _interopDefault(require('prop-types')); | ||
return Object.defineProperty(object, property, attr); | ||
} | ||
} // Passive options | ||
// Inspired by https://github.com/Modernizr/Modernizr/blob/master/feature-detects/dom/passiveeventlisteners.js | ||
// Passive options | ||
// Inspired by https://github.com/Modernizr/Modernizr/blob/master/feature-detects/dom/passiveeventlisteners.js | ||
var passiveOption = function () { | ||
var cache = null; | ||
return function () { | ||
@@ -36,8 +43,6 @@ if (cache !== null) { | ||
})); | ||
} catch (err) { | ||
// | ||
} catch (err) {// | ||
} | ||
cache = supportsPassiveOption; | ||
return supportsPassiveOption; | ||
@@ -47,14 +52,2 @@ }(); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
var defaultEventOptions = { | ||
@@ -66,3 +59,3 @@ capture: false, | ||
function mergeDefaultEventOptions(options) { | ||
return Object.assign({}, defaultEventOptions, options); | ||
return _extends({}, defaultEventOptions, options); | ||
} | ||
@@ -89,3 +82,3 @@ | ||
target = props.target, | ||
eventProps = _objectWithoutProperties(props, ['children', 'target']); | ||
eventProps = _objectWithoutProperties(props, ["children", "target"]); | ||
@@ -98,3 +91,5 @@ Object.keys(eventProps).forEach(function (name) { | ||
var prop = eventProps[name]; | ||
var type = typeof prop === 'undefined' ? 'undefined' : _typeof(prop); | ||
var type = _typeof(prop); | ||
var isObject = type === 'object'; | ||
@@ -114,3 +109,5 @@ var isFunction = type === 'function'; | ||
} else { | ||
iteratee(eventName, prop, mergeDefaultEventOptions({ capture: capture })); | ||
iteratee(eventName, prop, mergeDefaultEventOptions({ | ||
capture: capture | ||
})); | ||
} | ||
@@ -122,3 +119,2 @@ }); | ||
process.env.NODE_ENV !== "production" ? warning(options, 'react-event-listener: should be specified options in withOptions.') : void 0; | ||
return { | ||
@@ -130,13 +126,13 @@ handler: handler, | ||
var EventListener = function (_React$Component) { | ||
_inherits(EventListener, _React$Component); | ||
var EventListener = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
function EventListener() { | ||
_classCallCheck(this, EventListener); | ||
return _possibleConstructorReturn(this, (EventListener.__proto__ || Object.getPrototypeOf(EventListener)).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _getPrototypeOf(EventListener).apply(this, arguments)); | ||
} | ||
_createClass(EventListener, [{ | ||
key: 'componentDidMount', | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
@@ -146,3 +142,3 @@ this.addListeners(); | ||
}, { | ||
key: 'shouldComponentUpdate', | ||
key: "shouldComponentUpdate", | ||
value: function shouldComponentUpdate(nextProps) { | ||
@@ -152,3 +148,3 @@ return !shallowEqual(this.props, nextProps); | ||
}, { | ||
key: 'componentWillUpdate', | ||
key: "componentWillUpdate", | ||
value: function componentWillUpdate() { | ||
@@ -158,3 +154,3 @@ this.removeListeners(); | ||
}, { | ||
key: 'componentDidUpdate', | ||
key: "componentDidUpdate", | ||
value: function componentDidUpdate() { | ||
@@ -164,3 +160,3 @@ this.addListeners(); | ||
}, { | ||
key: 'componentWillUnmount', | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
@@ -170,3 +166,3 @@ this.removeListeners(); | ||
}, { | ||
key: 'addListeners', | ||
key: "addListeners", | ||
value: function addListeners() { | ||
@@ -176,3 +172,3 @@ this.applyListeners(on); | ||
}, { | ||
key: 'removeListeners', | ||
key: "removeListeners", | ||
value: function removeListeners() { | ||
@@ -182,7 +178,6 @@ this.applyListeners(off); | ||
}, { | ||
key: 'applyListeners', | ||
key: "applyListeners", | ||
value: function applyListeners(onOrOff) { | ||
var target = this.props.target; | ||
if (target) { | ||
@@ -199,3 +194,3 @@ var element = target; | ||
}, { | ||
key: 'render', | ||
key: "render", | ||
value: function render() { | ||
@@ -206,2 +201,4 @@ return this.props.children || null; | ||
_inherits(EventListener, _React$Component); | ||
return EventListener; | ||
@@ -215,2 +212,3 @@ }(React.Component); | ||
children: PropTypes.node, | ||
/** | ||
@@ -217,0 +215,0 @@ * The DOM target to listen to. |
@@ -0,1 +1,9 @@ | ||
import _classCallCheck from '@babel/runtime/helpers/builtin/es6/classCallCheck'; | ||
import _inherits from '@babel/runtime/helpers/builtin/es6/inherits'; | ||
import _createClass from '@babel/runtime/helpers/builtin/es6/createClass'; | ||
import _possibleConstructorReturn from '@babel/runtime/helpers/builtin/es6/possibleConstructorReturn'; | ||
import _getPrototypeOf from '@babel/runtime/helpers/builtin/es6/getPrototypeOf'; | ||
import _typeof from '@babel/runtime/helpers/builtin/es6/typeof'; | ||
import _objectWithoutProperties from '@babel/runtime/helpers/builtin/es6/objectWithoutProperties'; | ||
import _extends from '@babel/runtime/helpers/builtin/es6/extends'; | ||
import React from 'react'; | ||
@@ -8,9 +16,8 @@ import PropTypes from 'prop-types'; | ||
return Object.defineProperty(object, property, attr); | ||
} | ||
} // Passive options | ||
// Inspired by https://github.com/Modernizr/Modernizr/blob/master/feature-detects/dom/passiveeventlisteners.js | ||
// Passive options | ||
// Inspired by https://github.com/Modernizr/Modernizr/blob/master/feature-detects/dom/passiveeventlisteners.js | ||
var passiveOption = function () { | ||
var cache = null; | ||
return function () { | ||
@@ -29,8 +36,6 @@ if (cache !== null) { | ||
})); | ||
} catch (err) { | ||
// | ||
} catch (err) {// | ||
} | ||
cache = supportsPassiveOption; | ||
return supportsPassiveOption; | ||
@@ -40,14 +45,2 @@ }(); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
var defaultEventOptions = { | ||
@@ -59,3 +52,3 @@ capture: false, | ||
function mergeDefaultEventOptions(options) { | ||
return Object.assign({}, defaultEventOptions, options); | ||
return _extends({}, defaultEventOptions, options); | ||
} | ||
@@ -82,3 +75,3 @@ | ||
target = props.target, | ||
eventProps = _objectWithoutProperties(props, ['children', 'target']); | ||
eventProps = _objectWithoutProperties(props, ["children", "target"]); | ||
@@ -91,3 +84,5 @@ Object.keys(eventProps).forEach(function (name) { | ||
var prop = eventProps[name]; | ||
var type = typeof prop === 'undefined' ? 'undefined' : _typeof(prop); | ||
var type = _typeof(prop); | ||
var isObject = type === 'object'; | ||
@@ -107,3 +102,5 @@ var isFunction = type === 'function'; | ||
} else { | ||
iteratee(eventName, prop, mergeDefaultEventOptions({ capture: capture })); | ||
iteratee(eventName, prop, mergeDefaultEventOptions({ | ||
capture: capture | ||
})); | ||
} | ||
@@ -115,3 +112,2 @@ }); | ||
process.env.NODE_ENV !== "production" ? warning(options, 'react-event-listener: should be specified options in withOptions.') : void 0; | ||
return { | ||
@@ -123,13 +119,13 @@ handler: handler, | ||
var EventListener = function (_React$Component) { | ||
_inherits(EventListener, _React$Component); | ||
var EventListener = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
function EventListener() { | ||
_classCallCheck(this, EventListener); | ||
return _possibleConstructorReturn(this, (EventListener.__proto__ || Object.getPrototypeOf(EventListener)).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _getPrototypeOf(EventListener).apply(this, arguments)); | ||
} | ||
_createClass(EventListener, [{ | ||
key: 'componentDidMount', | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
@@ -139,3 +135,3 @@ this.addListeners(); | ||
}, { | ||
key: 'shouldComponentUpdate', | ||
key: "shouldComponentUpdate", | ||
value: function shouldComponentUpdate(nextProps) { | ||
@@ -145,3 +141,3 @@ return !shallowEqual(this.props, nextProps); | ||
}, { | ||
key: 'componentWillUpdate', | ||
key: "componentWillUpdate", | ||
value: function componentWillUpdate() { | ||
@@ -151,3 +147,3 @@ this.removeListeners(); | ||
}, { | ||
key: 'componentDidUpdate', | ||
key: "componentDidUpdate", | ||
value: function componentDidUpdate() { | ||
@@ -157,3 +153,3 @@ this.addListeners(); | ||
}, { | ||
key: 'componentWillUnmount', | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
@@ -163,3 +159,3 @@ this.removeListeners(); | ||
}, { | ||
key: 'addListeners', | ||
key: "addListeners", | ||
value: function addListeners() { | ||
@@ -169,3 +165,3 @@ this.applyListeners(on); | ||
}, { | ||
key: 'removeListeners', | ||
key: "removeListeners", | ||
value: function removeListeners() { | ||
@@ -175,7 +171,6 @@ this.applyListeners(off); | ||
}, { | ||
key: 'applyListeners', | ||
key: "applyListeners", | ||
value: function applyListeners(onOrOff) { | ||
var target = this.props.target; | ||
if (target) { | ||
@@ -192,3 +187,3 @@ var element = target; | ||
}, { | ||
key: 'render', | ||
key: "render", | ||
value: function render() { | ||
@@ -199,2 +194,4 @@ return this.props.children || null; | ||
_inherits(EventListener, _React$Component); | ||
return EventListener; | ||
@@ -208,2 +205,3 @@ }(React.Component); | ||
children: PropTypes.node, | ||
/** | ||
@@ -210,0 +208,0 @@ * The DOM target to listen to. |
@@ -10,2 +10,126 @@ (function (global, factory) { | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
} | ||
function _setPrototypeOf(o, p) { | ||
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { | ||
o.__proto__ = p; | ||
return o; | ||
}; | ||
return _setPrototypeOf(o, p); | ||
} | ||
function _inherits(subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function"); | ||
} | ||
setPrototypeOf(subClass.prototype, superClass && superClass.prototype); | ||
if (superClass) setPrototypeOf(subClass, superClass); | ||
} | ||
function _defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
function _createClass(Constructor, protoProps, staticProps) { | ||
if (protoProps) _defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) _defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
} | ||
function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); } | ||
function _typeof(obj) { | ||
if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") { | ||
_typeof = function _typeof(obj) { | ||
return _typeof2(obj); | ||
}; | ||
} else { | ||
_typeof = function _typeof(obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj); | ||
}; | ||
} | ||
return _typeof(obj); | ||
} | ||
function _assertThisInitialized(self) { | ||
if (self === void 0) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
return self; | ||
} | ||
function _possibleConstructorReturn(self, call) { | ||
if (call && (_typeof(call) === "object" || typeof call === "function")) { | ||
return call; | ||
} | ||
return _assertThisInitialized(self); | ||
} | ||
function _getPrototypeOf(o) { | ||
_getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { | ||
return o.__proto__; | ||
}; | ||
return _getPrototypeOf(o); | ||
} | ||
function _objectWithoutProperties(source, excluded) { | ||
if (source == null) return {}; | ||
var target = {}; | ||
var sourceKeys = Object.keys(source); | ||
var key, i; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
key = sourceKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
target[key] = source[key]; | ||
} | ||
if (Object.getOwnPropertySymbols) { | ||
var sourceSymbolKeys = Object.getOwnPropertySymbols(source); | ||
for (i = 0; i < sourceSymbolKeys.length; i++) { | ||
key = sourceSymbolKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; | ||
target[key] = source[key]; | ||
} | ||
} | ||
return target; | ||
} | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
/** | ||
@@ -127,9 +251,8 @@ * Copyright (c) 2013-present, Facebook, Inc. | ||
return Object.defineProperty(object, property, attr); | ||
} | ||
} // Passive options | ||
// Inspired by https://github.com/Modernizr/Modernizr/blob/master/feature-detects/dom/passiveeventlisteners.js | ||
// Passive options | ||
// Inspired by https://github.com/Modernizr/Modernizr/blob/master/feature-detects/dom/passiveeventlisteners.js | ||
var passiveOption = function () { | ||
var cache = null; | ||
return function () { | ||
@@ -148,8 +271,6 @@ if (cache !== null) { | ||
})); | ||
} catch (err) { | ||
// | ||
} catch (err) {// | ||
} | ||
cache = supportsPassiveOption; | ||
return supportsPassiveOption; | ||
@@ -159,14 +280,2 @@ }(); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
var defaultEventOptions = { | ||
@@ -178,3 +287,3 @@ capture: false, | ||
function mergeDefaultEventOptions(options) { | ||
return Object.assign({}, defaultEventOptions, options); | ||
return _extends({}, defaultEventOptions, options); | ||
} | ||
@@ -201,3 +310,3 @@ | ||
target = props.target, | ||
eventProps = _objectWithoutProperties(props, ['children', 'target']); | ||
eventProps = _objectWithoutProperties(props, ["children", "target"]); | ||
@@ -210,3 +319,5 @@ Object.keys(eventProps).forEach(function (name) { | ||
var prop = eventProps[name]; | ||
var type = typeof prop === 'undefined' ? 'undefined' : _typeof(prop); | ||
var type = _typeof(prop); | ||
var isObject = type === 'object'; | ||
@@ -226,3 +337,5 @@ var isFunction = type === 'function'; | ||
} else { | ||
iteratee(eventName, prop, mergeDefaultEventOptions({ capture: capture })); | ||
iteratee(eventName, prop, mergeDefaultEventOptions({ | ||
capture: capture | ||
})); | ||
} | ||
@@ -234,3 +347,2 @@ }); | ||
warning_1(options, 'react-event-listener: should be specified options in withOptions.'); | ||
return { | ||
@@ -242,13 +354,13 @@ handler: handler, | ||
var EventListener = function (_React$Component) { | ||
_inherits(EventListener, _React$Component); | ||
var EventListener = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
function EventListener() { | ||
_classCallCheck(this, EventListener); | ||
return _possibleConstructorReturn(this, (EventListener.__proto__ || Object.getPrototypeOf(EventListener)).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _getPrototypeOf(EventListener).apply(this, arguments)); | ||
} | ||
_createClass(EventListener, [{ | ||
key: 'componentDidMount', | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
@@ -258,3 +370,3 @@ this.addListeners(); | ||
}, { | ||
key: 'shouldComponentUpdate', | ||
key: "shouldComponentUpdate", | ||
value: function shouldComponentUpdate(nextProps) { | ||
@@ -264,3 +376,3 @@ return !shallowEqual_1(this.props, nextProps); | ||
}, { | ||
key: 'componentWillUpdate', | ||
key: "componentWillUpdate", | ||
value: function componentWillUpdate() { | ||
@@ -270,3 +382,3 @@ this.removeListeners(); | ||
}, { | ||
key: 'componentDidUpdate', | ||
key: "componentDidUpdate", | ||
value: function componentDidUpdate() { | ||
@@ -276,3 +388,3 @@ this.addListeners(); | ||
}, { | ||
key: 'componentWillUnmount', | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
@@ -282,3 +394,3 @@ this.removeListeners(); | ||
}, { | ||
key: 'addListeners', | ||
key: "addListeners", | ||
value: function addListeners() { | ||
@@ -288,3 +400,3 @@ this.applyListeners(on); | ||
}, { | ||
key: 'removeListeners', | ||
key: "removeListeners", | ||
value: function removeListeners() { | ||
@@ -294,7 +406,6 @@ this.applyListeners(off); | ||
}, { | ||
key: 'applyListeners', | ||
key: "applyListeners", | ||
value: function applyListeners(onOrOff) { | ||
var target = this.props.target; | ||
if (target) { | ||
@@ -311,3 +422,3 @@ var element = target; | ||
}, { | ||
key: 'render', | ||
key: "render", | ||
value: function render() { | ||
@@ -318,2 +429,4 @@ return this.props.children || null; | ||
_inherits(EventListener, _React$Component); | ||
return EventListener; | ||
@@ -327,2 +440,3 @@ }(React.Component); | ||
children: PropTypes.node, | ||
/** | ||
@@ -329,0 +443,0 @@ * The DOM target to listen to. |
{ | ||
"name": "react-event-listener", | ||
"version": "0.5.5", | ||
"version": "0.5.6", | ||
"description": "A React component that allow to bind events on the global scope", | ||
@@ -34,10 +34,13 @@ "main": "dist/react-event-listener.cjs.js", | ||
"devDependencies": { | ||
"babel-core": "^6.26.0", | ||
"@babel/core": "^7.0.0-beta.47", | ||
"@babel/plugin-transform-modules-commonjs": "^7.0.0-beta.47", | ||
"@babel/plugin-transform-runtime": "^7.0.0-beta.47", | ||
"@babel/preset-env": "^7.0.0-beta.47", | ||
"@babel/preset-react": "^7.0.0-beta.47", | ||
"@babel/preset-stage-3": "^7.0.0-beta.47", | ||
"@babel/register": "^7.0.0-beta.47", | ||
"babel-core": "^7.0.0-bridge.0", | ||
"babel-eslint": "^8.0.1", | ||
"babel-plugin-transform-dev-warning": "^0.1.0", | ||
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2", | ||
"babel-plugin-transform-react-remove-prop-types": "^0.4.9", | ||
"babel-preset-env": "^1.7.0", | ||
"babel-preset-react": "^6.24.1", | ||
"babel-preset-stage-2": "^6.24.1", | ||
"chai": "^4.1.2", | ||
@@ -63,3 +66,3 @@ "enzyme": "^3.1.0", | ||
"rollup": "^0.59.1", | ||
"rollup-plugin-babel": "^3.0.4", | ||
"rollup-plugin-babel": "^4.0.0-beta.4", | ||
"rollup-plugin-commonjs": "^9.1.3", | ||
@@ -73,2 +76,3 @@ "rollup-plugin-node-resolve": "^3.3.0", | ||
"dependencies": { | ||
"@babel/runtime": "^7.0.0-beta.42", | ||
"fbjs": "^0.8.16", | ||
@@ -75,0 +79,0 @@ "prop-types": "^15.6.0", |
@@ -13,3 +13,3 @@ import React from 'react'; | ||
function mergeDefaultEventOptions(options) { | ||
return Object.assign({}, defaultEventOptions, options); | ||
return { ...defaultEventOptions, ...options }; | ||
} | ||
@@ -16,0 +16,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
826
34706
5
38
+ Added@babel/runtime@7.26.0(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)
+ Addedua-parser-js@0.7.40(transitive)
- Removedua-parser-js@0.7.39(transitive)