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

react-i13n

Package Overview
Dependencies
Maintainers
9
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-i13n - npm Package Compare versions

Comparing version 3.0.0-alpha.5 to 3.0.0-alpha.6

2

dist-es/components/core/CoreComponent.js

@@ -77,3 +77,3 @@ /**

});
var ref = (i13nInstance === null || i13nInstance === void 0 ? void 0 : i13nInstance.isViewportEnabled()) ? domRef : {};
var ref = i13nInstance !== null && i13nInstance !== void 0 && i13nInstance.isViewportEnabled() ? domRef : {};
useViewportDetect({

@@ -80,0 +80,0 @@ viewport,

@@ -150,2 +150,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

}
cleanUpPlugins() {
this._eventsQueues = {};
this._plugins = {};
}
/**

@@ -152,0 +157,0 @@ * Get handlers from all plugin by event name

@@ -11,3 +11,3 @@ 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); }

*/
import React, { useMemo } from 'react';
import React, { useMemo, useEffect, useRef } from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';

@@ -58,2 +58,3 @@ import getDisplayName from '../utils/getDisplayName';

var isPluginsInitialized = useRef(false);
var {

@@ -64,9 +65,23 @@ i13nInstance: reactI13n,

if (reactI13n) {
plugins.forEach(plugin => {
reactI13n.plug(plugin);
});
reactI13n.createRootI13nNode();
}
var initializeReactI13n = () => {
if (reactI13n && !isPluginsInitialized.current) {
plugins.forEach(plugin => {
reactI13n.plug(plugin);
});
reactI13n.createRootI13nNode();
isPluginsInitialized.current = true;
}
}; // initial
initializeReactI13n(); // Update plugins if reactI13n instance changes
useEffect(() => {
isPluginsInitialized.current = false;
initializeReactI13n();
return () => {
isPluginsInitialized.current = false;
reactI13n === null || reactI13n === void 0 ? void 0 : reactI13n.cleanUpPlugins();
};
}, [reactI13n]);
var parentI13nNode = reactI13n === null || reactI13n === void 0 ? void 0 : reactI13n.getRootI13nNode();

@@ -73,0 +88,0 @@ var {

@@ -7,3 +7,3 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }

function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }

@@ -10,0 +10,0 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }

@@ -94,3 +94,3 @@ "use strict";

});
var ref = (i13nInstance === null || i13nInstance === void 0 ? void 0 : i13nInstance.isViewportEnabled()) ? domRef : {};
var ref = i13nInstance !== null && i13nInstance !== void 0 && i13nInstance.isViewportEnabled() ? domRef : {};
(0, _useViewportDetect["default"])({

@@ -97,0 +97,0 @@ viewport: viewport,

@@ -157,2 +157,7 @@ "use strict";

this._eventsQueues[plugin.name] = new _EventsQueue["default"](plugin);
};
_proto.cleanUpPlugins = function cleanUpPlugins() {
this._eventsQueues = {};
this._plugins = {};
}

@@ -159,0 +164,0 @@ /**

@@ -69,2 +69,4 @@ "use strict";

var isPluginsInitialized = (0, _react.useRef)(false);
var _useReactI13nRoot = (0, _useReactI13nRoot2["default"])(options),

@@ -74,9 +76,23 @@ reactI13n = _useReactI13nRoot.i13nInstance,

if (reactI13n) {
plugins.forEach(function (plugin) {
reactI13n.plug(plugin);
});
reactI13n.createRootI13nNode();
}
var initializeReactI13n = function initializeReactI13n() {
if (reactI13n && !isPluginsInitialized.current) {
plugins.forEach(function (plugin) {
reactI13n.plug(plugin);
});
reactI13n.createRootI13nNode();
isPluginsInitialized.current = true;
}
}; // initial
initializeReactI13n(); // Update plugins if reactI13n instance changes
(0, _react.useEffect)(function () {
isPluginsInitialized.current = false;
initializeReactI13n();
return function () {
isPluginsInitialized.current = false;
reactI13n === null || reactI13n === void 0 ? void 0 : reactI13n.cleanUpPlugins();
};
}, [reactI13n]);
var parentI13nNode = reactI13n === null || reactI13n === void 0 ? void 0 : reactI13n.getRootI13nNode();

@@ -83,0 +99,0 @@

@@ -17,4 +17,6 @@ "use strict";

function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

@@ -21,0 +23,0 @@

@@ -28,3 +28,3 @@ "use strict";

function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }

@@ -31,0 +31,0 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }

{
"name": "react-i13n",
"description": "React I13n provides a performant and scalable solution to application instrumentation.",
"version": "3.0.0-alpha.5",
"version": "3.0.0-alpha.6",
"main": "index.js",

@@ -6,0 +6,0 @@ "module": "index.es.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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