react-clientside-effect
Advanced tools
Comparing version 1.2.0 to 1.2.1
import _inheritsLoose from '@babel/runtime/helpers/inheritsLoose'; | ||
import _defineProperty from '@babel/runtime/helpers/defineProperty'; | ||
import React, { Component } from 'react'; | ||
import shallowEqual from 'shallowequal'; | ||
import React, { PureComponent } from 'react'; | ||
@@ -40,7 +39,7 @@ function withSideEffect(reducePropsToState, handleStateChangeOnClient) { | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inheritsLoose(SideEffect, _Component); | ||
function (_PureComponent) { | ||
_inheritsLoose(SideEffect, _PureComponent); | ||
function SideEffect() { | ||
return _Component.apply(this, arguments) || this; | ||
return _PureComponent.apply(this, arguments) || this; | ||
} | ||
@@ -55,6 +54,2 @@ | ||
_proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) { | ||
return !shallowEqual(nextProps, this.props); | ||
}; | ||
_proto.componentDidMount = function componentDidMount() { | ||
@@ -80,3 +75,3 @@ mountedInstances.push(this); | ||
return SideEffect; | ||
}(Component); | ||
}(PureComponent); | ||
@@ -83,0 +78,0 @@ _defineProperty(SideEffect, "displayName", "SideEffect(" + getDisplayName(WrappedComponent) + ")"); |
@@ -9,3 +9,2 @@ 'use strict'; | ||
var React__default = _interopDefault(React); | ||
var shallowEqual = _interopDefault(require('shallowequal')); | ||
@@ -46,7 +45,7 @@ function withSideEffect(reducePropsToState, handleStateChangeOnClient) { | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inheritsLoose(SideEffect, _Component); | ||
function (_PureComponent) { | ||
_inheritsLoose(SideEffect, _PureComponent); | ||
function SideEffect() { | ||
return _Component.apply(this, arguments) || this; | ||
return _PureComponent.apply(this, arguments) || this; | ||
} | ||
@@ -61,6 +60,2 @@ | ||
_proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) { | ||
return !shallowEqual(nextProps, this.props); | ||
}; | ||
_proto.componentDidMount = function componentDidMount() { | ||
@@ -86,3 +81,3 @@ mountedInstances.push(this); | ||
return SideEffect; | ||
}(React.Component); | ||
}(React.PureComponent); | ||
@@ -89,0 +84,0 @@ _defineProperty(SideEffect, "displayName", "SideEffect(" + getDisplayName(WrappedComponent) + ")"); |
@@ -34,49 +34,2 @@ (function (global, factory) { | ||
// | ||
var shallowequal = function shallowEqual(objA, objB, compare, compareContext) { | ||
var ret = compare ? compare.call(compareContext, objA, objB) : void 0; | ||
if (ret !== void 0) { | ||
return !!ret; | ||
} | ||
if (objA === objB) { | ||
return true; | ||
} | ||
if (typeof objA !== "object" || !objA || typeof objB !== "object" || !objB) { | ||
return false; | ||
} | ||
var keysA = Object.keys(objA); | ||
var keysB = Object.keys(objB); | ||
if (keysA.length !== keysB.length) { | ||
return false; | ||
} | ||
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); | ||
// Test for A's keys different from B. | ||
for (var idx = 0; idx < keysA.length; idx++) { | ||
var key = keysA[idx]; | ||
if (!bHasOwnProperty(key)) { | ||
return false; | ||
} | ||
var valueA = objA[key]; | ||
var valueB = objB[key]; | ||
ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0; | ||
if (ret === false || (ret === void 0 && valueA !== valueB)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
}; | ||
function withSideEffect(reducePropsToState, handleStateChangeOnClient) { | ||
@@ -116,7 +69,7 @@ if (process.env.NODE_ENV !== "production") { | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
inheritsLoose(SideEffect, _Component); | ||
function (_PureComponent) { | ||
inheritsLoose(SideEffect, _PureComponent); | ||
function SideEffect() { | ||
return _Component.apply(this, arguments) || this; | ||
return _PureComponent.apply(this, arguments) || this; | ||
} | ||
@@ -131,6 +84,2 @@ | ||
_proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) { | ||
return !shallowequal(nextProps, this.props); | ||
}; | ||
_proto.componentDidMount = function componentDidMount() { | ||
@@ -156,3 +105,3 @@ mountedInstances.push(this); | ||
return SideEffect; | ||
}(React.Component); | ||
}(React.PureComponent); | ||
@@ -159,0 +108,0 @@ defineProperty(SideEffect, "displayName", "SideEffect(" + getDisplayName(WrappedComponent) + ")"); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):e.withSideEffect=t(e.React)}(this,function(e){"use strict";var t="default"in e?e.default:e;var n=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t};var o=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},r=function(e,t,n,o){var r=n?n.call(o,e,t):void 0;if(void 0!==r)return!!r;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),u=Object.keys(t);if(i.length!==u.length)return!1;for(var c=Object.prototype.hasOwnProperty.bind(t),p=0;p<i.length;p++){var f=i[p];if(!c(f))return!1;var a=e[f],d=t[f];if(!1===(r=n?n.call(o,a,d,f):void 0)||void 0===r&&a!==d)return!1}return!0};return function(i,u){if("production"!==process.env.NODE_ENV){if("function"!=typeof i)throw new Error("Expected reducePropsToState to be a function.");if("function"!=typeof u)throw new Error("Expected handleStateChangeOnClient to be a function.")}return function(c){if("production"!==process.env.NODE_ENV&&"function"!=typeof c)throw new Error("Expected WrappedComponent to be a React component.");var p,f=[];function a(){p=i(f.map(function(e){return e.props})),u(p)}var d=function(e){function o(){return e.apply(this,arguments)||this}n(o,e),o.peek=function(){return p};var i=o.prototype;return i.shouldComponentUpdate=function(e){return!r(e,this.props)},i.componentDidMount=function(){f.push(this),a()},i.componentDidUpdate=function(){a()},i.componentWillUnmount=function(){var e=f.indexOf(this);f.splice(e,1),a()},i.render=function(){return t.createElement(c,this.props)},o}(e.Component);return o(d,"displayName","SideEffect("+function(e){return e.displayName||e.name||"Component"}(c)+")"),d}}}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):e.withSideEffect=t(e.React)}(this,function(e){"use strict";var t="default"in e?e.default:e;var n=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t};var o=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e};return function(r,i){if("production"!==process.env.NODE_ENV){if("function"!=typeof r)throw new Error("Expected reducePropsToState to be a function.");if("function"!=typeof i)throw new Error("Expected handleStateChangeOnClient to be a function.")}return function(c){if("production"!==process.env.NODE_ENV&&"function"!=typeof c)throw new Error("Expected WrappedComponent to be a React component.");var u,p=[];function f(){u=r(p.map(function(e){return e.props})),i(u)}var a=function(e){function o(){return e.apply(this,arguments)||this}n(o,e),o.peek=function(){return u};var r=o.prototype;return r.componentDidMount=function(){p.push(this),f()},r.componentDidUpdate=function(){f()},r.componentWillUnmount=function(){var e=p.indexOf(this);p.splice(e,1),f()},r.render=function(){return t.createElement(c,this.props)},o}(e.PureComponent);return o(a,"displayName","SideEffect("+function(e){return e.displayName||e.name||"Component"}(c)+")"),a}}}); |
{ | ||
"name": "react-clientside-effect", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Create components whose prop changes map to a global side effect", | ||
"main": "lib/index.js", | ||
"jsnext:main": "lib/index.es.js", | ||
"module": "lib/index.es.js", | ||
@@ -36,7 +35,6 @@ "scripts": { | ||
"peerDependencies": { | ||
"react": "^0.13.0 || ^0.14.0 || ^15.0.0 || ^16.0.0" | ||
"react": "^15.3.0 || ^16.0.0" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.0.0", | ||
"shallowequal": "^1.1.0" | ||
"@babel/runtime": "^7.0.0" | ||
}, | ||
@@ -43,0 +41,0 @@ "devDependencies": { |
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
2
16461
222
- Removedshallowequal@^1.1.0
- Removedshallowequal@1.1.0(transitive)