dphelper 1.2.3 → 1.2.5
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/.github/README.md +25 -3
- package/README.md +25 -3
- package/index.js +1 -1
- package/package.json +2 -20
- package/types/cache.d.ts +9 -0
- package/types/observer.d.ts +30 -0
- package/types/state.d.ts +13 -1
- package/types/store.d.ts +6 -6
package/.github/README.md
CHANGED
|
@@ -6,7 +6,7 @@ dpHelper Devtools by Dario Passariello
|
|
|
6
6
|
|
|
7
7
|

|
|
8
8
|
|
|
9
|
-
Manager | DevTools by [Dario Passariello
|
|
9
|
+
Manager | DevTools by [Dario Passariello](https://dario.passariello.ca) (c)
|
|
10
10
|
|
|
11
11
|
<!--  -->
|
|
12
12
|

|
|
@@ -65,14 +65,36 @@ state
|
|
|
65
65
|
If you want to run a funtion everytime a state change you can use:
|
|
66
66
|
|
|
67
67
|
```javascript
|
|
68
|
-
|
|
68
|
+
// Observer is a non cumulative listener, is trigged from customEvent / dispatch from state
|
|
69
|
+
observer(
|
|
70
|
+
"test",
|
|
71
|
+
()=>alert("Test Changes to: " + state.test)
|
|
72
|
+
)
|
|
69
73
|
```
|
|
70
74
|
|
|
71
75
|
You can use it everywere. Works like "useState" in react but with more flexibility
|
|
72
76
|
|
|
73
77
|
## State vs Store 🎅
|
|
74
78
|
|
|
75
|
-
**INFO**: if you want to use as permanent storage (localStorage) you need to use " **store
|
|
79
|
+
**INFO**: if you want to use as permanent storage (localStorage) you need to use " **store** " instead state.
|
|
80
|
+
**IMPORTANT**: Store use localStorage... data are persistant and you need to remove if necessary for security (like logout)
|
|
81
|
+
|
|
82
|
+
**SECURITY**: Do not store any sensitive data. Data stay in the computer if are not properly removed
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
// Set a store:
|
|
86
|
+
store.set("test",{test:"test"})
|
|
87
|
+
|
|
88
|
+
// Get a store:
|
|
89
|
+
store.get("test") -> {test:"test"}
|
|
90
|
+
|
|
91
|
+
// Remove a store:
|
|
92
|
+
store.delete("test") -> "ok"
|
|
93
|
+
|
|
94
|
+
// Remove all:
|
|
95
|
+
store.clearAll() -> "ok"
|
|
96
|
+
|
|
97
|
+
```
|
|
76
98
|
|
|
77
99
|
---
|
|
78
100
|
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ dpHelper Devtools by Dario Passariello
|
|
|
6
6
|
|
|
7
7
|

|
|
8
8
|
|
|
9
|
-
Manager | DevTools by [Dario Passariello
|
|
9
|
+
Manager | DevTools by [Dario Passariello](https://dario.passariello.ca) (c)
|
|
10
10
|
|
|
11
11
|
<!--  -->
|
|
12
12
|

|
|
@@ -65,14 +65,36 @@ state
|
|
|
65
65
|
If you want to run a funtion everytime a state change you can use:
|
|
66
66
|
|
|
67
67
|
```javascript
|
|
68
|
-
|
|
68
|
+
// Observer is a non cumulative listener, is trigged from customEvent / dispatch from state
|
|
69
|
+
observer(
|
|
70
|
+
"test",
|
|
71
|
+
()=>alert("Test Changes to: " + state.test)
|
|
72
|
+
)
|
|
69
73
|
```
|
|
70
74
|
|
|
71
75
|
You can use it everywere. Works like "useState" in react but with more flexibility
|
|
72
76
|
|
|
73
77
|
## State vs Store 🎅
|
|
74
78
|
|
|
75
|
-
**INFO**: if you want to use as permanent storage (localStorage) you need to use " **store
|
|
79
|
+
**INFO**: if you want to use as permanent storage (localStorage) you need to use " **store** " instead state.
|
|
80
|
+
**IMPORTANT**: Store use localStorage... data are persistant and you need to remove if necessary for security (like logout)
|
|
81
|
+
|
|
82
|
+
**SECURITY**: Do not store any sensitive data. Data stay in the computer if are not properly removed
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
// Set a store:
|
|
86
|
+
store.set("test",{test:"test"})
|
|
87
|
+
|
|
88
|
+
// Get a store:
|
|
89
|
+
store.get("test") -> {test:"test"}
|
|
90
|
+
|
|
91
|
+
// Remove a store:
|
|
92
|
+
store.delete("test") -> "ok"
|
|
93
|
+
|
|
94
|
+
// Remove all:
|
|
95
|
+
store.clearAll() -> "ok"
|
|
96
|
+
|
|
97
|
+
```
|
|
76
98
|
|
|
77
99
|
---
|
|
78
100
|
|