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

react-gateway

Package Overview
Dependencies
Maintainers
8
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-gateway - npm Package Compare versions

Comparing version 2.5.0 to 2.6.0

7

lib/Gateway.js

@@ -34,2 +34,3 @@ 'use strict';

Gateway.prototype.componentWillMount = function componentWillMount() {
this.id = this.gatewayRegistry.register(this.props.into, this.props.children);
this.renderIntoGatewayNode(this.props);

@@ -39,3 +40,3 @@ };

Gateway.prototype.componentWillReceiveProps = function componentWillReceiveProps(props) {
this.gatewayRegistry.clearChild(this.props.into, this.props.children);
this.gatewayRegistry.clearChild(this.props.into, this.id);
this.renderIntoGatewayNode(props);

@@ -45,7 +46,7 @@ };

Gateway.prototype.componentWillUnmount = function componentWillUnmount() {
this.gatewayRegistry.removeChild(this.props.into, this.props.children);
this.gatewayRegistry.unregister(this.props.into, this.id);
};
Gateway.prototype.renderIntoGatewayNode = function renderIntoGatewayNode(props) {
this.gatewayRegistry.addChild(this.props.into, props.children);
this.gatewayRegistry.addChild(this.props.into, this.id, props.children);
};

@@ -52,0 +53,0 @@

@@ -13,6 +13,11 @@ "use strict";

this._children = {};
// Unique key for children of a gateway
this._currentId = 0;
}
GatewayRegistry.prototype._renderContainer = function _renderContainer(name) {
if (!this._containers[name]) {
var _this = this;
if (!this._containers[name] || !this._children[name]) {
return;

@@ -22,3 +27,5 @@ }

this._containers[name].setState({
children: this._children[name]
children: Object.keys(this._children[name]).sort().map(function (id) {
return _this._children[name][id];
})
});

@@ -36,16 +43,23 @@ };

GatewayRegistry.prototype.addChild = function addChild(name, child) {
this._children[name] = this._children[name] || [];
this._children[name].push(child);
GatewayRegistry.prototype.addChild = function addChild(name, gatewayId, child) {
this._children[name][gatewayId] = child;
this._renderContainer(name);
};
GatewayRegistry.prototype.clearChild = function clearChild(name, child) {
this._children[name] = this._children[name].filter(function (item) {
return item !== child;
});
GatewayRegistry.prototype.clearChild = function clearChild(name, gatewayId) {
delete this._children[name][gatewayId];
};
GatewayRegistry.prototype.removeChild = function removeChild(name, child) {
this.clearChild(name, child);
GatewayRegistry.prototype.register = function register(name, child) {
this._children[name] = this._children[name] || {};
var gatewayId = name + "_" + this._currentId;
this._children[name][gatewayId] = child;
this._currentId += 1;
return gatewayId;
};
GatewayRegistry.prototype.unregister = function unregister(name, gatewayId) {
this.clearChild(name, gatewayId);
this._renderContainer(name);

@@ -52,0 +66,0 @@ };

{
"name": "react-gateway",
"version": "2.5.0",
"version": "2.6.0",
"description": "Render React DOM into a new context",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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