hermes-io 2.8.52 → 2.8.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{useCallback as t}from"react";export function useStore(e){var a=e.store,r=e.reducer,u=e.data,o=t(function(t){var e=t.type,u=t.payload,o=t.targets,n=r(a.state,{type:e,payload:u});return a.notify({type:e,payload:u,state:n,targets:o})},[]),n=t(function(t,e){var r;return null!=(r=t(a))?r:e},[]);return a.state||(a.state=u),a.mutate=o,a.query=n,{query:n,mutate:o,state:a.state}}
1
+ import{useCallback as t,useEffect as e}from"react";export function useStore(r){var a=r.store,n=r.reducer,o=r.data,u=t(function(t){var e=t.type,r=t.payload,o=t.targets,u=n(a.state,{type:e,payload:r});return a.notify({type:e,payload:r,state:u,targets:o})},[]),l=t(function(t,e){var r;return null!=(r=t(a))?r:e},[]);return a.state||(a.state=o),a.mutate=u,a.query=l,e(function(){return function(){var t;return null==a?void 0:null==(t=a.removeFromCollection)?void 0:t.call(a)}},[]),{query:l,mutate:u,state:a.state}}
@@ -1 +1 @@
1
- export var Store=function(t){var e=this,o=t.context,n=t.observer;this.context=null,this.observer=null,this.notify=function(t){return e.observer.notify({context:e.context,value:t})},this.query=function(){return console.log("method is not conencted to the reducer, please call useStore first")},this.mutate=function(){return console.log("method is not connected to the store, you need call useStore first")},this.context=o,this.observer=n};
1
+ export var Store=function(t){var e=this,o=t.context,n=t.observer;this.context=null,this.observer=null,this.notify=function(t){return e.observer.notify({context:e.context,value:t})},this.query=function(){return console.log("method is not conencted to the reducer, please call useStore first")},this.mutate=function(){return console.log("method is not connected to the store, you need call useStore first")},this.context=o,this.observer=n};export var MicroStore=function(){var t=this;this.collection=new Map,this.add=function(e,o){return t.collection.set(e,o),o.removeFromCollection=function(){return t.collection.delete(e)},o},this.get=function(e){return t.collection.get(e)}};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hermes-io",
3
- "version": "2.8.52",
3
+ "version": "2.8.53",
4
4
  "description": "A lightweight React library that allows communication between Reactjs components by using the observer pattern and the hook api",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",