Socket
Book a DemoInstallSign in
Socket

react-proxy

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-proxy - npm Package Compare versions

Comparing version

to
0.6.0

modules/getForceUpdate.js

170

dist/ReactProxy.js
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"));
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define(["react"], factory);
define(factory);
else if(typeof exports === 'object')
exports["ReactProxy"] = factory(require("react"));
exports["ReactProxy"] = factory();
else
root["ReactProxy"] = factory(root["React"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_38__) {
root["ReactProxy"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap

@@ -69,2 +69,6 @@ /******/ // The module cache

var _getForceUpdate = __webpack_require__(14);
exports.getForceUpdate = _interopRequire(_getForceUpdate);
/***/ },

@@ -108,3 +112,3 @@ /* 1 */

var getLength = __webpack_require__(29),
var getLength = __webpack_require__(30),
isLength = __webpack_require__(5);

@@ -148,3 +152,3 @@

var isNative = __webpack_require__(34);
var isNative = __webpack_require__(35);

@@ -380,3 +384,3 @@ /**

isObject = __webpack_require__(1),
shimKeys = __webpack_require__(32);
shimKeys = __webpack_require__(33);

@@ -518,6 +522,2 @@ /* Native method references for those with the same name as other `lodash` methods. */

var _react = __webpack_require__(38);
var _react2 = _interopRequireDefault(_react);
var _createPrototypeProxy = __webpack_require__(13);

@@ -529,10 +529,2 @@

/**
* Force-updates an instance regardless of whether
* it descends from React.Component or not.
*/
function forceUpdate(instance) {
_react2['default'].Component.prototype.forceUpdate.call(instance);
}
function proxyClass(InitialClass) {

@@ -558,3 +550,3 @@ var prototypeProxy = (0, _createPrototypeProxy2['default'])();

// Update the prototype proxy with new methods
prototypeProxy.update(NextClass.prototype);
var mountedInstances = prototypeProxy.update(NextClass.prototype);

@@ -570,5 +562,2 @@ // Set up the constructor property so accessing the statics work

// Grab all mounted instances
var mountedInstances = prototypeProxy.getMountedInstances();
// We might have added new methods that need to be auto-bound

@@ -578,4 +567,4 @@ mountedInstances.forEach(_bindAutoBindMethods.bindAutoBindMethods);

// Force redraw regardless of shouldComponentUpdate()
mountedInstances.forEach(forceUpdate);
// Let the user take care of redrawing
return mountedInstances;
};

@@ -610,7 +599,7 @@

var _lodashObjectAssign = __webpack_require__(35);
var _lodashObjectAssign = __webpack_require__(36);
var _lodashObjectAssign2 = _interopRequireDefault(_lodashObjectAssign);
var _lodashArrayDifference = __webpack_require__(14);
var _lodashArrayDifference = __webpack_require__(15);

@@ -743,2 +732,4 @@ var _lodashArrayDifference2 = _interopRequireDefault(_lodashArrayDifference);

proxy.__proto__ = next;
return mountedInstances;
}

@@ -753,13 +744,5 @@

/**
* Returns an array of all mounted instances.
*/
function getMountedInstances() {
return mountedInstances;
}
return {
update: update,
get: get,
getMountedInstances: getMountedInstances
get: get
};

@@ -775,4 +758,27 @@ }

var baseDifference = __webpack_require__(20),
baseFlatten = __webpack_require__(21),
/**
* Returns a function that force-updates an instance
* regardless of whether it descends from React.Component or not.
*/
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = getForceUpdate;
function getForceUpdate(React) {
return function (instance) {
React.Component.prototype.forceUpdate.call(instance);
};
}
module.exports = exports["default"];
/***/ },
/* 15 */
/***/ function(module, exports, __webpack_require__) {
var baseDifference = __webpack_require__(21),
baseFlatten = __webpack_require__(22),
isArrayLike = __webpack_require__(2),

@@ -808,6 +814,6 @@ isObjectLike = __webpack_require__(3),

/***/ },
/* 15 */
/* 16 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {var cachePush = __webpack_require__(26),
/* WEBPACK VAR INJECTION */(function(global) {var cachePush = __webpack_require__(27),
getNative = __webpack_require__(4);

@@ -845,3 +851,3 @@

/***/ },
/* 16 */
/* 17 */
/***/ function(module, exports, __webpack_require__) {

@@ -872,3 +878,3 @@

/***/ },
/* 17 */
/* 18 */
/***/ function(module, exports, __webpack_require__) {

@@ -911,6 +917,6 @@

/***/ },
/* 18 */
/* 19 */
/***/ function(module, exports, __webpack_require__) {
var baseCopy = __webpack_require__(19),
var baseCopy = __webpack_require__(20),
keys = __webpack_require__(10);

@@ -937,3 +943,3 @@

/***/ },
/* 19 */
/* 20 */
/***/ function(module, exports, __webpack_require__) {

@@ -967,8 +973,8 @@

/***/ },
/* 20 */
/* 21 */
/***/ function(module, exports, __webpack_require__) {
var baseIndexOf = __webpack_require__(22),
cacheIndexOf = __webpack_require__(25),
createCache = __webpack_require__(28);
var baseIndexOf = __webpack_require__(23),
cacheIndexOf = __webpack_require__(26),
createCache = __webpack_require__(29);

@@ -1029,6 +1035,6 @@ /** Used as the size to enable large array optimizations. */

/***/ },
/* 21 */
/* 22 */
/***/ function(module, exports, __webpack_require__) {
var arrayPush = __webpack_require__(16),
var arrayPush = __webpack_require__(17),
isArguments = __webpack_require__(7),

@@ -1077,6 +1083,6 @@ isArray = __webpack_require__(8),

/***/ },
/* 22 */
/* 23 */
/***/ function(module, exports, __webpack_require__) {
var indexOfNaN = __webpack_require__(30);
var indexOfNaN = __webpack_require__(31);

@@ -1111,3 +1117,3 @@ /**

/***/ },
/* 23 */
/* 24 */
/***/ function(module, exports, __webpack_require__) {

@@ -1132,6 +1138,6 @@

/***/ },
/* 24 */
/* 25 */
/***/ function(module, exports, __webpack_require__) {
var identity = __webpack_require__(37);
var identity = __webpack_require__(38);

@@ -1178,3 +1184,3 @@ /**

/***/ },
/* 25 */
/* 26 */
/***/ function(module, exports, __webpack_require__) {

@@ -1204,3 +1210,3 @@

/***/ },
/* 26 */
/* 27 */
/***/ function(module, exports, __webpack_require__) {

@@ -1231,7 +1237,7 @@

/***/ },
/* 27 */
/* 28 */
/***/ function(module, exports, __webpack_require__) {
var bindCallback = __webpack_require__(24),
isIterateeCall = __webpack_require__(31),
var bindCallback = __webpack_require__(25),
isIterateeCall = __webpack_require__(32),
restParam = __webpack_require__(9);

@@ -1279,6 +1285,6 @@

/***/ },
/* 28 */
/* 29 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {var SetCache = __webpack_require__(15),
/* WEBPACK VAR INJECTION */(function(global) {var SetCache = __webpack_require__(16),
getNative = __webpack_require__(4);

@@ -1308,6 +1314,6 @@

/***/ },
/* 29 */
/* 30 */
/***/ function(module, exports, __webpack_require__) {
var baseProperty = __webpack_require__(23);
var baseProperty = __webpack_require__(24);

@@ -1330,3 +1336,3 @@ /**

/***/ },
/* 30 */
/* 31 */
/***/ function(module, exports, __webpack_require__) {

@@ -1360,3 +1366,3 @@

/***/ },
/* 31 */
/* 32 */
/***/ function(module, exports, __webpack_require__) {

@@ -1395,3 +1401,3 @@

/***/ },
/* 32 */
/* 33 */
/***/ function(module, exports, __webpack_require__) {

@@ -1403,3 +1409,3 @@

isLength = __webpack_require__(5),
keysIn = __webpack_require__(36);
keysIn = __webpack_require__(37);

@@ -1444,3 +1450,3 @@ /** Used for native method references. */

/***/ },
/* 33 */
/* 34 */
/***/ function(module, exports, __webpack_require__) {

@@ -1489,6 +1495,6 @@

/***/ },
/* 34 */
/* 35 */
/***/ function(module, exports, __webpack_require__) {
var isFunction = __webpack_require__(33),
var isFunction = __webpack_require__(34),
isObjectLike = __webpack_require__(3);

@@ -1544,8 +1550,8 @@

/***/ },
/* 35 */
/* 36 */
/***/ function(module, exports, __webpack_require__) {
var assignWith = __webpack_require__(17),
baseAssign = __webpack_require__(18),
createAssigner = __webpack_require__(27);
var assignWith = __webpack_require__(18),
baseAssign = __webpack_require__(19),
createAssigner = __webpack_require__(28);

@@ -1594,3 +1600,3 @@ /**

/***/ },
/* 36 */
/* 37 */
/***/ function(module, exports, __webpack_require__) {

@@ -1665,3 +1671,3 @@

/***/ },
/* 37 */
/* 38 */
/***/ function(module, exports, __webpack_require__) {

@@ -1691,10 +1697,4 @@

/***/ },
/* 38 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __WEBPACK_EXTERNAL_MODULE_38__;
/***/ }
/******/ ])
});

@@ -10,6 +10,2 @@ 'use strict';

var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _createPrototypeProxy = require('./createPrototypeProxy');

@@ -21,10 +17,2 @@

/**
* Force-updates an instance regardless of whether
* it descends from React.Component or not.
*/
function forceUpdate(instance) {
_react2['default'].Component.prototype.forceUpdate.call(instance);
}
function proxyClass(InitialClass) {

@@ -50,3 +38,3 @@ var prototypeProxy = (0, _createPrototypeProxy2['default'])();

// Update the prototype proxy with new methods
prototypeProxy.update(NextClass.prototype);
var mountedInstances = prototypeProxy.update(NextClass.prototype);

@@ -62,5 +50,2 @@ // Set up the constructor property so accessing the statics work

// Grab all mounted instances
var mountedInstances = prototypeProxy.getMountedInstances();
// We might have added new methods that need to be auto-bound

@@ -70,4 +55,4 @@ mountedInstances.forEach(_bindAutoBindMethods.bindAutoBindMethods);

// Force redraw regardless of shouldComponentUpdate()
mountedInstances.forEach(forceUpdate);
// Let the user take care of redrawing
return mountedInstances;
};

@@ -74,0 +59,0 @@

@@ -142,2 +142,4 @@ 'use strict';

proxy.__proto__ = next;
return mountedInstances;
}

@@ -152,13 +154,5 @@

/**
* Returns an array of all mounted instances.
*/
function getMountedInstances() {
return mountedInstances;
}
return {
update: update,
get: get,
getMountedInstances: getMountedInstances
get: get
};

@@ -165,0 +159,0 @@ }

@@ -11,2 +11,6 @@ 'use strict';

exports.createProxy = _interopRequire(_createClassProxy);
exports.createProxy = _interopRequire(_createClassProxy);
var _getForceUpdate = require('./getForceUpdate');
exports.getForceUpdate = _interopRequire(_getForceUpdate);
{
"name": "react-proxy",
"version": "0.5.0",
"version": "0.6.0",
"description": "Proxies React components without unmounting or losing their state.",

@@ -8,3 +8,3 @@ "main": "modules/index.js",

"build": "rimraf modules dist && webpack && babel src --out-dir modules",
"test": "mocha --compilers js:babel/register --recursive ./tests",
"test": "mocha --compilers js:babel/register --recursive ./test",
"test:watch": "npm run test -- --watch",

@@ -23,5 +23,2 @@ "prepublish": "npm run build"

"homepage": "https://github.com/gaearon/react-proxy",
"peerDependencies": {
"react": ">=0.13.0"
},
"devDependencies": {

@@ -28,0 +25,0 @@ "babel": "^5.1.13",

@@ -8,2 +8,6 @@ # React Proxy [![build status](https://img.shields.io/travis/gaearon/react-proxy/master.svg?style=flat-square)](https://travis-ci.org/gaearon/react-proxy) [![npm version](https://img.shields.io/npm/v/react-proxy.svg?style=flat-square)](https://www.npmjs.com/package/react-proxy)

## Requirements
* React 0.13+
## Usage

@@ -41,10 +45,16 @@

```js
import { createProxy } from 'react-proxy';
import { createProxy, getForceUpdate } from 'react-proxy';
const proxy = createProxy(ComponentVersion1);
const Component = proxy.get();
React.render(<Component />, rootEl);
const Proxy = proxy.get();
React.render(<Proxy />, rootEl);
proxy.update(ComponentVersion2); // will keep the state and DOM
// will update the mounted instances' prototypes:
// both DOM and state are perserved.
const mountedInstances = proxy.update(ComponentVersion2);
// works with React Native and non-Component descendants
const forceUpdate = getForceUpdate(React);
mountedInstances.forEach(forceUpdate);
```

@@ -51,0 +61,0 @@

@@ -1,13 +0,4 @@

import React from 'react';
import createPrototypeProxy from './createPrototypeProxy';
import { bindAutoBindMethods, deleteUnknownAutoBindMethods } from './bindAutoBindMethods';
/**
* Force-updates an instance regardless of whether
* it descends from React.Component or not.
*/
function forceUpdate(instance) {
React.Component.prototype.forceUpdate.call(instance);
}
export default function proxyClass(InitialClass) {

@@ -33,3 +24,3 @@ const prototypeProxy = createPrototypeProxy();

// Update the prototype proxy with new methods
prototypeProxy.update(NextClass.prototype);
const mountedInstances = prototypeProxy.update(NextClass.prototype);

@@ -45,5 +36,2 @@ // Set up the constructor property so accessing the statics work

// Grab all mounted instances
const mountedInstances = prototypeProxy.getMountedInstances();
// We might have added new methods that need to be auto-bound

@@ -53,4 +41,4 @@ mountedInstances.forEach(bindAutoBindMethods);

// Force redraw regardless of shouldComponentUpdate()
mountedInstances.forEach(forceUpdate);
// Let the user take care of redrawing
return mountedInstances;
};

@@ -57,0 +45,0 @@

@@ -126,2 +126,4 @@ import assign from 'lodash/object/assign';

proxy.__proto__ = next;
return mountedInstances;
}

@@ -136,14 +138,6 @@

/**
* Returns an array of all mounted instances.
*/
function getMountedInstances() {
return mountedInstances;
}
return {
update,
get,
getMountedInstances
get
};
};
export { default as createProxy } from './createClassProxy';
export { default as getForceUpdate } from './getForceUpdate';

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.