Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grape-web

Package Overview
Dependencies
Maintainers
2
Versions
152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grape-web - npm Package Compare versions

Comparing version 0.37.0 to 0.38.0

lib/outside-click/index.js

72

lib/global-event/GlobalEvent.js

@@ -20,3 +20,3 @@ 'use strict';

// - enable children to be emitter
// - enable debounce, throttle
// - enable throttle
// - use onClick etc instead of events

@@ -27,28 +27,24 @@

_createClass(GlobalEvent, null, [{
key: 'propTypes',
value: {
emitter: _react.PropTypes.object,
event: _react.PropTypes.string.isRequired,
debounce: _react.PropTypes.number,
handler: _react.PropTypes.func,
children: _react.PropTypes.element
},
enumerable: true
}, {
key: 'defaultProps',
value: {
emitter: window,
event: undefined,
handler: undefined,
debounce: 0
},
enumerable: true
}]);
function GlobalEvent() {
var _this = this;
function GlobalEvent(props) {
_classCallCheck(this, GlobalEvent);
_get(Object.getPrototypeOf(GlobalEvent.prototype), 'constructor', this).call(this, props);
this.handler = this.handler.bind(this);
_get(Object.getPrototypeOf(GlobalEvent.prototype), 'constructor', this).apply(this, arguments);
this.handler = function (e) {
var _props = _this.props;
var debounce = _props.debounce;
var handler = _props.handler;
if (debounce === undefined) {
handler(e);
return;
}
clearTimeout(_this.timeoutId);
_this.timeoutId = setTimeout(function () {
handler(e);
}, debounce);
};
}

@@ -67,14 +63,2 @@

}, {
key: 'handler',
value: function handler(e) {
var _this = this;
if (this.props.debounce) {
clearTimeout(this.timeoutId);
this.timeoutId = setTimeout(function () {
_this.props.handler(e);
});
} else this.props.handler(e);
}
}, {
key: 'render',

@@ -84,2 +68,18 @@ value: function render() {

}
}], [{
key: 'propTypes',
value: {
emitter: _react.PropTypes.object,
event: _react.PropTypes.string.isRequired,
debounce: _react.PropTypes.number,
handler: _react.PropTypes.func,
children: _react.PropTypes.element
},
enumerable: true
}, {
key: 'defaultProps',
value: {
emitter: window
},
enumerable: true
}]);

@@ -86,0 +86,0 @@

{
"name": "grape-web",
"version": "0.37.0",
"version": "0.38.0",
"dependencies": {

@@ -5,0 +5,0 @@ "jss-isolate": "^1.0.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc