UNPKG

react-global-state-hooks

Version:

This is a package to easily handling global-state across your react components No-redux, No-context.

1 lines 1.6 kB
var e;e=e=>(()=>{"use strict";var t={362:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createCustomGlobalState=void 0;var a=o(963);t.createCustomGlobalState=function(e){var t=e.onInitialize,o=e.onChange;return function(e){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=l.callbacks,r=function(e,t){var o={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(o[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(a=Object.getOwnPropertySymbols(e);l<a.length;l++)t.indexOf(a[l])<0&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(o[a[l]]=e[a[l]])}return o}(l,["callbacks"]);return(0,a.createGlobalState)(e,Object.assign(Object.assign({},r),{callbacks:Object.assign(Object.assign({},null!=n?n:{}),{onInit:function(e){var o;null==t||t(e,null==r?void 0:r.config),null===(o=null==n?void 0:n.onInit)||void 0===o||o.call(n,e)},onStateChanged:function(e){var t;null==o||o(e,null==r?void 0:r.config),null===(t=null==n?void 0:n.onStateChanged)||void 0===t||t.call(n,e)}})}))}},t.default=t.createCustomGlobalState},963:t=>{t.exports=e}},o={};return function e(a){var l=o[a];if(void 0!==l)return l.exports;var n=o[a]={exports:{}};return t[a](n,n.exports,e),n.exports}(362)})(),"object"==typeof exports&&"object"==typeof module?module.exports=e(require("./createGlobalState.js")):"function"==typeof define&&define.amd?define(["./createGlobalState.js"],e):"object"==typeof exports?exports["react-global-state-hooks"]=e(require("./createGlobalState.js")):this["react-global-state-hooks"]=e(this["./createGlobalState.js"]);