hermes-io 2.2.20 → 2.2.21

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/utils/README.md +0 -63
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hermes-io",
3
- "version": "2.2.20",
3
+ "version": "2.2.21",
4
4
  "description": "A lightweight javascript 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",
package/utils/README.md DELETED
@@ -1,63 +0,0 @@
1
- # hermes-io ⚡
2
- A lightweight javascript library that allows communication between components by using the observer pattern and the hook api.
3
-
4
- ## Usage:
5
- ```javascript
6
- import React, { useState } from "react";
7
- import Products from "./components/Products/Products"
8
- import ShoppingCar from "./components/ShoppingCar/ShoppingCar";
9
- import { useObserver } from "hermes-io";
10
- import ProductsObservers from './observers/products';
11
- import theme from '@theme';
12
- import * as contexts from './contexts';
13
-
14
- const filterSelectes = (collection) => collection.filter((item) => item.selected); //filter selectes products
15
-
16
- function App() {
17
- const [products, setProducts] = useState(ProductsStore.get('collection'));
18
-
19
- const handleRemoveProduct = ({ value: product = {} }) => {
20
- product.selected = false;
21
- setProducts([...ProductsStore.get('collection')]);
22
- };
23
-
24
- const handleAddProduct = ({ value: product = {} }) => {
25
- product.selected = true;
26
- setProducts([...ProductsStore.get('collection')]);
27
- };
28
-
29
- useObserver({
30
- observer: ProductsObservers.add,
31
- listener: handleAddProduct,
32
- contexts: [contexts.products],
33
- });
34
-
35
- useObserver({
36
- observer: ProductsObservers.remove,
37
- listener: handleRemoveProduct,
38
- contexts: [contexts.shoppingCar, contexts.products],
39
- });
40
-
41
- return (
42
- <>
43
- <ShoppingCar data={filterSelectes(products)} />
44
- <Products data={products} />
45
- </>
46
- );
47
- }
48
-
49
- export default App;
50
-
51
- ```
52
- ## Chrome extension
53
- Install from chrome web store [here](https://chrome.google.com/webstore/detail/hermes-io/pjdkgcpikfmkncldipldmimanfkpeedm?hl=en)
54
-
55
- ![chrome extension](https://raw.githubusercontent.com/Maxtermax/hermes-io-devtools/master/demo.gif)
56
-
57
- ## Documentation:
58
- https://github.com/Maxtermax/hermes-io#readme
59
-
60
- ## Contributing:
61
- Feel free to open a PR explaining your changes, this library is open to suggestions and improvements.
62
-
63
- https://github.com/Maxtermax/hermes-io