hermes-io 2.8.68 → 2.8.70
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.
- package/lib/hooks/useStore.js +1 -1
- package/lib/store/store.js +1 -1
- package/package.json +1 -1
package/lib/hooks/useStore.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{useCallback as t,useEffect as l,useRef as r}from"react";export function useStore(n){var e=n.microStore,u=n.reducer,a=n.data,o=r(n.store).current,i=o.mutate=t(function(t){var l=t.type,r=t.payload,n=t.targets,e=u(o.state,{type:l,payload:r});return o.notify({type:l,payload:r,state:e,targets:n})},[]),d=o.query=t(function(t,l){var r;return null!=(r=t(o))?r:l},[]);return o.state||(o.state=a),l(function(){var t,l;return null==e||null==(t=e.add)||t.call(e,null==o?void 0:o.id,o),null==e||null==(l=e.notify)||l.call(e),function(){var t;return null==e?void 0:null==(t=e.remove)?void 0:t.call(e,null==o?void 0:o.id)}},[null==e?void 0:e.add,null==e?void 0:e.notify,null==o?void 0:o.id]),{query:d,mutate:i,store:o}}
|
package/lib/store/store.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function _set_prototype_of(t,e){return(_set_prototype_of=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}import{Observer as t}from"../observer/observer";export var Store=function(t){var e=this,o=t.context,r=t.observer,n=t.id
|
|
1
|
+
function _set_prototype_of(t,e){return(_set_prototype_of=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}import{Observer as t}from"../observer/observer";export var Store=function(t){var e=this,o=t.context,r=t.observer,n=t.id;this.context=null,this.observer=null,this.id=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.id=n,this.context=o,this.observer=r};export var MicroStore=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.collection=new Map,e.add=function(t,o){return e.collection.set(t,o),o},e.remove=function(t){return e.collection.delete(t)},e.get=function(t){return e.collection.get(t)},e}return!function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_set_prototype_of(t,e)}(e,t),e}(t);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hermes-io",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.70",
|
|
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",
|