use-global-hook
Advanced tools
Comparing version
@@ -20,2 +20,3 @@ 'use strict'; | ||
} : originalHook; | ||
newListener.run(store.state); | ||
store.listeners.push(newListener); | ||
@@ -22,0 +23,0 @@ return cleanUpListener.cleanUpListener(store, newListener); |
@@ -1,2 +0,2 @@ | ||
/** @license UseGlobalHook v0.2.2 | ||
/** @license UseGlobalHook v0.2.3 | ||
* | ||
@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the |
@@ -15,2 +15,3 @@ import { cleanUpListener as cleanUpListener$1 } from './cleanUpListener.js'; | ||
} : originalHook; | ||
newListener.run(store.state); | ||
store.listeners.push(newListener); | ||
@@ -17,0 +18,0 @@ return cleanUpListener$1(store, newListener); |
@@ -1,2 +0,2 @@ | ||
/** @license UseGlobalHook v0.2.2 | ||
/** @license UseGlobalHook v0.2.3 | ||
* | ||
@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the |
{ | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"author": "andregardi", | ||
@@ -23,4 +23,5 @@ "name": "use-global-hook", | ||
], | ||
"dependencies": {}, | ||
"main": "./cjs/index.js", | ||
"module": "./esm/index.js" | ||
} |
@@ -1,2 +0,2 @@ | ||
/** @license UseGlobalHook v0.2.2 | ||
/** @license UseGlobalHook v0.2.3 | ||
* | ||
@@ -87,2 +87,3 @@ * This source code is licensed under the MIT license found in the | ||
} : originalHook; | ||
newListener.run(store.state); | ||
store.listeners.push(newListener); | ||
@@ -89,0 +90,0 @@ return cleanUpListener(store, newListener); |
@@ -1,2 +0,2 @@ | ||
/** @license UseGlobalHook v0.2.2 | ||
/** @license UseGlobalHook v0.2.3 | ||
* | ||
@@ -6,2 +6,2 @@ * This source code is licensed under the MIT license found in the | ||
*/ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).UseGlobalHook=n()}(this,(function(){"use strict";function t(n){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(n)}function n(){return(n=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t}).apply(this,arguments)}function e(t,e,o){t.state=n({},t.state,e),t.runListeners(),o&&o()}function o(t,n,e,o){var r=e?e(t.state):t.state,i=function(t,n,e){return n.useMemo((function(){return e?e(t.actions):t.actions}),[e,t.actions])}(t,n,o),u=n.useState(Object.create(null))[1];return n.useEffect(function(t,n,e){return function(){var o={oldState:{}};return o.run=n?function(t){var r=n(t);r!==o.oldState&&(o.oldState=r,e(r))}:e,t.listeners.push(o),function(t,n){return function(){t.listeners=t.listeners.filter((function(t){return t!==n}))}}(t,o)}}(t,e,u),[]),[r,i]}var r=function(t){t.listeners.forEach((function(n){n.run(t.state)}))};var i=function(n,e){var o=e.setState;e.setState=function(t){t instanceof Function?(e.state=n(e.state,t),e.runListeners()):o(t)},function n(e,o){var r={};return Object.keys(o).forEach((function(i){if("function"==typeof o[i]){var u=o[i];o[i]=function(t,n){return function(){var e=n.apply(void 0,arguments);"function"==typeof e&&t.setState(e)}}(e,u)}"object"===t(o[i])&&(r[i]=n(e,o[i]))})),r}(e,e.actions)};return function(n,u,f,c){var s={state:u,listeners:[]};return s.setState=e.bind(null,s),s.runListeners=r.bind(null,s),s.actions=function n(e,o){var r={};return Object.keys(o).forEach((function(i){"function"==typeof o[i]&&(r[i]=o[i].bind(null,e)),"object"===t(o[i])&&(r[i]=n(e,o[i]))})),r}(s,f),function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n instanceof Function)n(t);else{var e=n.Immer,o=n.initializer;e&&i(e,t),o&&o(t)}}(s,c),o.bind(null,s,n)}})); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).UseGlobalHook=n()}(this,(function(){"use strict";function t(n){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(n)}function n(){return(n=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t}).apply(this,arguments)}function e(t,e,o){t.state=n({},t.state,e),t.runListeners(),o&&o()}function o(t,n,e,o){var r=e?e(t.state):t.state,i=function(t,n,e){return n.useMemo((function(){return e?e(t.actions):t.actions}),[e,t.actions])}(t,n,o),u=n.useState(Object.create(null))[1];return n.useEffect(function(t,n,e){return function(){var o={oldState:{}};return o.run=n?function(t){var r=n(t);r!==o.oldState&&(o.oldState=r,e(r))}:e,o.run(t.state),t.listeners.push(o),function(t,n){return function(){t.listeners=t.listeners.filter((function(t){return t!==n}))}}(t,o)}}(t,e,u),[]),[r,i]}var r=function(t){t.listeners.forEach((function(n){n.run(t.state)}))};var i=function(n,e){var o=e.setState;e.setState=function(t){t instanceof Function?(e.state=n(e.state,t),e.runListeners()):o(t)},function n(e,o){var r={};return Object.keys(o).forEach((function(i){if("function"==typeof o[i]){var u=o[i];o[i]=function(t,n){return function(){var e=n.apply(void 0,arguments);"function"==typeof e&&t.setState(e)}}(e,u)}"object"===t(o[i])&&(r[i]=n(e,o[i]))})),r}(e,e.actions)};return function(n,u,f,c){var s={state:u,listeners:[]};return s.setState=e.bind(null,s),s.runListeners=r.bind(null,s),s.actions=function n(e,o){var r={};return Object.keys(o).forEach((function(i){"function"==typeof o[i]&&(r[i]=o[i].bind(null,e)),"object"===t(o[i])&&(r[i]=n(e,o[i]))})),r}(s,f),function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n instanceof Function)n(t);else{var e=n.Immer,o=n.initializer;e&&i(e,t),o&&o(t)}}(s,c),o.bind(null,s,n)}})); |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
25313
0.56%491
0.61%0
-100%