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

react-singleton-hook

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-singleton-hook - npm Package Compare versions

Comparing version 3.0.141 to 3.0.142

12

dist/react-singleton-hook.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-dom')) :
typeof define === 'function' && define.amd ? define(['exports', 'react', 'react-dom'], factory) :
(global = global || self, factory(global.ReactSingletonHook = {}, global.React, global.ReactDOM));
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactSingletonHook = {}, global.React, global.ReactDOM));
}(this, (function (exports, React, reactDom) { 'use strict';
var React__default = 'default' in React ? React['default'] : React;
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
function _extends() {

@@ -59,3 +61,3 @@ _extends = Object.assign || function (target) {

if (window && window.document) {
reactDom.render( /*#__PURE__*/React__default.createElement(C, null), window.document.createElement('div'));
reactDom.render( /*#__PURE__*/React__default['default'].createElement(C, null), window.document.createElement('div'));
} else {

@@ -102,4 +104,4 @@ warning('Can not mount SingletonHooksContainer on server side. ' + 'Did you manage to run useEffect on server? ' + 'Please mount SingletonHooksContainer into your components tree manually.');

}, []);
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, hooks.map(function (h, i) {
return /*#__PURE__*/React__default.createElement(SingleItemContainer, _extends({}, h, {
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, hooks.map(function (h, i) {
return /*#__PURE__*/React__default['default'].createElement(SingleItemContainer, _extends({}, h, {
key: i

@@ -106,0 +108,0 @@ }));

@@ -1,1 +0,1 @@

!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],e):e((n=n||self).ReactSingletonHook={},n.React,n.ReactDOM)}(this,(function(n,e,t){"use strict";var o="default"in e?e.default:e;function r(){return(r=Object.assign||function(n){for(var e=1;arguments.length>e;e++){var t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o])}return n}).apply(this,arguments)}var u=function(n){var t=n.useHookBody,o=n.applyStateChange,r=e.useRef(n.initValue);if("function"!=typeof t)throw Error("function expected as hook body parameter. got "+typeof t);var u=t();return e.useLayoutEffect((function(){r.current!==u&&(r.current=u,o(u))}),[o,u]),null},i=function(n){console&&console.warn&&console.warn(n)},a=!1,c=!1,f=!1,s=[],l=function(n){s.push(n)},d=function(){c=!0,e.useEffect((function(){return a&&i("SingletonHooksContainer is mounted second time. You should mount SingletonHooksContainer before any other component and never unmount it.Alternatively, dont use SingletonHooksContainer it at all, we will handle that for you."),a=!0,function(){return i("SingletonHooksContainer is removed from DOM. its not supported, singleton hooks will stop updating.")}}),[]);var n=e.useState([]),t=n[0],f=n[1];return e.useEffect((function(){l=function(n){return f((function(e){return[].concat(e,[n])}))},f(s)}),[]),o.createElement(o.Fragment,null,t.map((function(n,e){return o.createElement(u,r({},n,{key:e}))})))},p=function(n){var e;c||f||(f=!0,e=d,window&&window.document?t.render(o.createElement(e,null),window.document.createElement("div")):i("Can not mount SingletonHooksContainer on server side. Did you manage to run useEffect on server? Please mount SingletonHooksContainer into your components tree manually.")),l(n)},m=function(n,o){var r=!1,u=!1,i=void 0,a=[],c=function(n){i=n,t.unstable_batchedUpdates((function(){return a.forEach((function(e){return e(n)}))}))},f=function(){return u||(i="function"==typeof n?n():n,u=!0),i};return function(){var t=e.useState(f),u=t[0],s=t[1];return e.useEffect((function(){return r||(r=!0,p({initValue:n,useHookBody:o,applyStateChange:c})),a.push(s),i!==u&&s(i),function(){a.splice(a.indexOf(s),1)}}),[]),u}},y={singletonHook:m,SingletonHooksContainer:d};n.SingletonHooksContainer=d,n.default=y,n.singletonHook=m,Object.defineProperty(n,"__esModule",{value:!0})}));
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).ReactSingletonHook={},n.React,n.ReactDOM)}(this,(function(n,e,t){"use strict";function o(n){return n&&"object"==typeof n&&"default"in n?n:{default:n}}var r=o(e);function u(){return(u=Object.assign||function(n){for(var e=1;arguments.length>e;e++){var t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o])}return n}).apply(this,arguments)}var i=function(n){var t=n.useHookBody,o=n.applyStateChange,r=e.useRef(n.initValue);if("function"!=typeof t)throw Error("function expected as hook body parameter. got "+typeof t);var u=t();return e.useLayoutEffect((function(){r.current!==u&&(r.current=u,o(u))}),[o,u]),null},a=function(n){console&&console.warn&&console.warn(n)},f=!1,c=!1,l=!1,s=[],d=function(n){s.push(n)},p=function(){c=!0,e.useEffect((function(){return f&&a("SingletonHooksContainer is mounted second time. You should mount SingletonHooksContainer before any other component and never unmount it.Alternatively, dont use SingletonHooksContainer it at all, we will handle that for you."),f=!0,function(){return a("SingletonHooksContainer is removed from DOM. its not supported, singleton hooks will stop updating.")}}),[]);var n=e.useState([]),t=n[0],o=n[1];return e.useEffect((function(){d=function(n){return o((function(e){return[].concat(e,[n])}))},o(s)}),[]),r.default.createElement(r.default.Fragment,null,t.map((function(n,e){return r.default.createElement(i,u({},n,{key:e}))})))},m=function(n){var e;c||l||(l=!0,e=p,window&&window.document?t.render(r.default.createElement(e,null),window.document.createElement("div")):a("Can not mount SingletonHooksContainer on server side. Did you manage to run useEffect on server? Please mount SingletonHooksContainer into your components tree manually.")),d(n)},y=function(n,o){var r=!1,u=!1,i=void 0,a=[],f=function(n){i=n,t.unstable_batchedUpdates((function(){return a.forEach((function(e){return e(n)}))}))},c=function(){return u||(i="function"==typeof n?n():n,u=!0),i};return function(){var t=e.useState(c),u=t[0],l=t[1];return e.useEffect((function(){return r||(r=!0,m({initValue:n,useHookBody:o,applyStateChange:f})),a.push(l),i!==u&&l(i),function(){a.splice(a.indexOf(l),1)}}),[]),u}},g={singletonHook:y,SingletonHooksContainer:p};n.SingletonHooksContainer=p,n.default=g,n.singletonHook=y,Object.defineProperty(n,"__esModule",{value:!0})}));
{
"name": "react-singleton-hook",
"version": "3.0.141",
"version": "3.0.142",
"description": "Share custom hook state across all components",

@@ -49,34 +49,34 @@ "keywords": [

"devDependencies": {
"@babel/cli": "^7.10.5",
"@babel/core": "^7.10.5",
"@babel/plugin-proposal-object-rest-spread": "^7.10.4",
"@babel/plugin-transform-react-display-name": "^7.10.4",
"@babel/plugin-transform-react-jsx": "^7.10.4",
"@babel/preset-env": "^7.10.4",
"@rollup/plugin-commonjs": "^14.0.0",
"@rollup/plugin-node-resolve": "^8.4.0",
"@babel/cli": "^7.12.1",
"@babel/core": "^7.12.3",
"@babel/plugin-proposal-object-rest-spread": "^7.12.1",
"@babel/plugin-transform-react-display-name": "^7.12.1",
"@babel/plugin-transform-react-jsx": "^7.12.1",
"@babel/preset-env": "^7.12.1",
"@rollup/plugin-commonjs": "^15.1.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"@rollup/plugin-replace": "^2.3.3",
"@testing-library/jest-dom": "^5.11.1",
"@testing-library/jest-native": "^3.1.0",
"@testing-library/react": "^10.4.7",
"@testing-library/react-hooks": "^3.3.0",
"@testing-library/react-native": "^5.0.3",
"@testing-library/jest-dom": "^5.11.5",
"@testing-library/jest-native": "^3.4.3",
"@testing-library/react": "^11.1.0",
"@testing-library/react-hooks": "^3.4.2",
"@testing-library/react-native": "^7.1.0",
"babel-eslint": "^10.1.0",
"babel-jest": "^26.1.0",
"babel-jest": "^26.6.1",
"cross-env": "^7.0.2",
"es3ify": "^0.2.2",
"eslint": "^7.4.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-react": "^7.20.3",
"eslint-plugin-react-hooks": "^4.0.8",
"eslint": "^7.11.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.2.0",
"glob": "^7.1.6",
"jest": "^26.1.0",
"jest": "^26.6.1",
"react": "^16.8.6",
"react-dom": "^16.13.1",
"react-native": "^0.63.1",
"react-test-renderer": "^16.13.1",
"react-dom": "^17.0.1",
"react-native": "^0.63.3",
"react-test-renderer": "^17.0.1",
"rimraf": "^3.0.2",
"rollup": "^2.22.0",
"rollup": "^2.32.1",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-terser": "^6.1.0"
"rollup-plugin-terser": "^7.0.2"
},

@@ -83,0 +83,0 @@ "browserify": {

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