dphelper 2.5.1 → 2.5.3

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/LICENSE.md CHANGED
@@ -1,9 +1,21 @@
1
- # MIT LICENSE
1
+ # The MIT License (MIT)
2
2
 
3
- Copyright (C) 1995-2026 by Dario Passariello
3
+ Copyright (c) 2026 by Dario Passariello
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
6
11
 
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
8
14
 
9
- THE SOFTWARE IS PROVIDED AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -33,9 +33,7 @@
33
33
  3. [Session](#session)
34
34
  4. [Observer](#observer)
35
35
  5. [useObserver](#useobserver)
36
- 5. [Extension](#extension)
37
- 6. [Security](#security)
38
- 7. [License](#license)
36
+ 5. [Security](#security)
39
37
 
40
38
  ## About
41
39
 
package/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "dphelper",
3
- "version": "2.5.1",
3
+ "version": "2.5.3",
4
4
  "description": "dphelper devtools, data management for developers by Dario Passariello",
5
5
  "homepage": "https://a51.gitbook.io/dphelper",
6
6
  "copyright": "Dario Passariello",
7
- "main": "./index.js",
7
+ "main": "./dist/index.js",
8
+ "files": [
9
+ "dist"
10
+ ],
8
11
  "license": "MIT",
9
12
  "deprecated": false,
10
13
  "preferGlobal": true,
@@ -47,11 +50,7 @@
47
50
  },
48
51
  "cdn": {}
49
52
  },
50
- "author": {
51
- "name": "Dario Passariello",
52
- "url": "https://dario.passariello.ca/",
53
- "email": "dariopassariello@gmail.com"
54
- },
53
+ "author": "Dario Passariello <dariopassariello@gmail.com>",
55
54
  "support": {
56
55
  "name": "Dario Passariello",
57
56
  "url": "https://github.com/passariello/",
@@ -61,16 +60,14 @@
61
60
  "contributors": [
62
61
  {
63
62
  "name": "Dario Passariello",
64
- "email": "dariopassarielloa@gmail.com"
63
+ "url": "https://dario.passariello.ca/",
64
+ "email": "dariopassariello@gmail.com"
65
65
  },
66
66
  {
67
67
  "name": "Valeria Cala Scaglitta",
68
68
  "email": "valeriacalascaglitta@gmail.com"
69
69
  }
70
70
  ],
71
- "workspaces": [
72
- ".dev"
73
- ],
74
71
  "npmName": "dphelper",
75
72
  "npmFileMap": [
76
73
  {
@@ -163,20 +160,20 @@
163
160
  },
164
161
  "dependencies": {
165
162
  "dphelper.types": "0.0.20",
166
- "memorio": "2.1.3",
167
- "jquery": "3.7.1"
163
+ "jquery": "3.7.1",
164
+ "memorio": "2.1.3"
168
165
  },
169
166
  "devDependencies": {
170
- "@babel/eslint-parser": "^7.28.5",
167
+ "@babel/eslint-parser": "^7.28.6",
171
168
  "@eslint/js": "9.39.2",
172
169
  "@playwright/test": "1.57.0",
173
170
  "@testing-library/jest-dom": "6.9.1",
174
171
  "@testing-library/react": "16.3.1",
175
172
  "@types/jest": "30.0.0",
176
- "@types/node": "^25.0.6",
173
+ "@types/node": "^25.0.9",
177
174
  "@types/webpack-env": "1.18.8",
178
- "@typescript-eslint/eslint-plugin": "8.52.0",
179
- "@typescript-eslint/parser": "8.52.0",
175
+ "@typescript-eslint/eslint-plugin": "8.53.0",
176
+ "@typescript-eslint/parser": "8.53.0",
180
177
  "copy-webpack-plugin": "^13.0.1",
181
178
  "crypto-js": "4.2.0",
182
179
  "esbuild-loader": "4.4.2",
@@ -192,6 +189,6 @@
192
189
  "typescript": "5.9.3",
193
190
  "webpack": "^5.104.1",
194
191
  "webpack-cli": "6.0.1",
195
- "webpack-dev-server": "^5.2.2"
192
+ "webpack-dev-server": "^5.2.3"
196
193
  }
197
194
  }
package/DISCLAIMER.md DELETED
@@ -1,11 +0,0 @@
1
- # DISCLAIMER
2
-
3
- ```text
4
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
6
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
7
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
8
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
9
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
10
- SOFTWARE.
11
- ```
package/FUNDING.yml DELETED
@@ -1,12 +0,0 @@
1
- # These are supported funding model platforms
2
-
3
- github: passariello
4
- patreon: passariello
5
- ko_fi: passariello
6
- liberapay: passariello
7
- issuehunt: passariello
8
- custom:
9
- [
10
- "https://dario.passariello.ca",
11
- "https://www.indiegogo.com/individuals/28513718",
12
- ]
package/docs/_config.yml DELETED
@@ -1 +0,0 @@
1
- theme: jekyll-theme-modernist
package/docs/index.md DELETED
@@ -1,364 +0,0 @@
1
- # [dphelper](https://npmjs.com/package/dphelper)
2
-
3
- ![dpHelper](https://raw.githubusercontent.com/passariello/container/refs/heads/main/dphelper/assets/images/banner.svg)
4
-
5
- **Manager | DevTools** by [Dario Passariello](https://dario.passariello.ca) (c)
6
-
7
- [![version](https://img.shields.io/npm/v/dphelper.svg)](https://npmjs.org/package/dphelper)
8
- [![downloads](https://img.shields.io/npm/dm/dphelper.svg)](https://npmjs.org/package/dphelper)
9
-
10
- ![jQuery](https://img.shields.io/badge/jQuery-gray?logo=jQuery)
11
- ![Javascript](https://img.shields.io/badge/Javascript-gray?logo=Javascript)
12
- ![React](https://img.shields.io/badge/React-gray?logo=React)
13
- ![TypeScript](https://img.shields.io/badge/TypeScript-gray?logo=typescript)
14
-
15
- ![Node.js](https://img.shields.io/badge/Node.js-gray?logo=node.js)
16
- ![Jest](https://img.shields.io/badge/Jest-gray?logo=jest)
17
- ![ESLint](https://img.shields.io/badge/Eslint-gray?logo=eslint)
18
- ![webpack](https://img.shields.io/badge/webpack-gray?logo=webpack)
19
-
20
- ![Snik](https://img.shields.io/badge/Snyk-gray?logo=Snyk)
21
- ![Snik](https://img.shields.io/badge/Socket-gray?logo=socket)
22
-
23
- [![GitBook](https://img.shields.io/static/v1?message=Documented%20on%20GitBook&logo=gitbook&logoColor=ffffff&label=%20&labelColor=5c5c5c&color=3F89A1)](https://a51.gitbook.io/dphelper)
24
-
25
- ## Table of Contents
26
-
27
- 1. [About](#about)
28
- 2. [Installation](#install)
29
- 3. [Live Demo](#live-demo)
30
- 4. [Documentation](#documentation)
31
- 1. [State](#state)
32
- 2. [Store](#store)
33
- 3. [Session](#session)
34
- 4. [Observer](#observer)
35
- 5. [useObserver](#useobserver)
36
- 5. [Extension](#extension)
37
- 6. [Security](#security)
38
- 7. [License](#license)
39
-
40
- ## About
41
-
42
- dpHelper is a precise and complete collection of 190+ tools ready to use in all web/SaaS applications. State and Store Management are now easy, accessible everywhere in your application, including Ajax or React apps, without the need for extra files.
43
-
44
- 1. **Single Source of Truth**: The application's entire state is held within a single object in one store, ensuring consistent and accessible state management throughout the app.
45
-
46
- 2. **State is flexible**: State changes are facilitated exclusively through actions. These actions, which are straightforward JavaScript objects, delineate what has occurred. This methodology ensures that state changes remain predictable.
47
-
48
- 3. **Changes are made with proxy handle function**: To define state changes, dpHelper employs pure functions as intermediaries. These functions accept the current state as input and produce a new state as output, ensuring predictability and ease of testing in the system.
49
-
50
- <!-- 4. **Based on [Memorio](https://www.npmjs.com/package/memorio) by Dario Passariello** to manage STATE, STORE, SESSION and OBSERVER. You can use Memorio is you need only state management. DpHelper is indicate when you use a complete suite of tools. -->
51
-
52
- ### Example in React
53
-
54
- ```js
55
- import { useEffect } from 'react';
56
- import 'dphelper';
57
-
58
- function App() {
59
- // Store a value in the state
60
- state.test = 'Hello, World!';
61
-
62
- // Use the stored value in a React component
63
- useEffect(() => {
64
- console.log("You can recall from all pages: " + state.test); // Output: "Hello, World!"
65
- }, []);
66
-
67
- return (
68
- <div>
69
- <h1>{state.test}</h1>
70
- </div>
71
- );
72
- }
73
-
74
- export default App;
75
- ```
76
-
77
- ## Install
78
-
79
- Install dpHelper.
80
-
81
- ```shell
82
- npm i dphelper --save-dev
83
- ```
84
-
85
- or update:
86
-
87
- ```shell
88
- npm i dphelper@latest --save-dev
89
- ```
90
-
91
- Use it in the main root file (and only there):
92
-
93
- ```js
94
- import "dphelper";
95
- ```
96
-
97
- or
98
-
99
- ```js
100
- require("dphelper");
101
- ```
102
-
103
- ## Install for EJS or Other Types of Projects (like HTML)
104
-
105
- Note: You don't need to use npm install in this case, or you will get an error.
106
-
107
- ```html
108
- <script src="https://cdn.jsdelivr.net/npm/dphelper@latest"></script>
109
- ```
110
-
111
- ## Live Demo
112
-
113
- [https://tests.a51.dev/](https://tests.a51.dev/)
114
-
115
- You can see an HTML version where dpHelper and LayerPro work together seamlessly. dpHelper is compatible with a variety of frontend libraries, including:
116
-
117
- * HTML
118
- * React
119
- * Vue
120
- * And any other frontend library
121
-
122
- ## Documentation
123
-
124
- You can see:
125
-
126
- * [State](https://a51.gitbook.io/dphelper/general/state)
127
- * [Store](https://a51.gitbook.io/dphelper/general/store)
128
- * [Observer](https://a51.gitbook.io/dphelper/general/observer)
129
- * [useObserver](https://a51.gitbook.io/dphelper/general/useobserver)
130
- * [List of functions](https://a51.gitbook.io/dphelper/general/tools)
131
-
132
- You can see more tutorials, information, and examples about **dpHelper** [clicking here](https://a51.gitbook.io/dphelper).
133
-
134
- ## State
135
-
136
- ### Using the "state"
137
-
138
- You can use the state function to store and reuse data throughout your application. Similar to other state managers, you can save state information in JSON format and access it easily in various contexts, including React useEffect and/or dispatch.
139
-
140
- For example, you can store a value like this: _state.test = 'I am ready'_ and then retrieve it later using state.test.
141
-
142
- _example:_
143
-
144
- You can use the browser's devtools console and type " **state.test = 'I am ready'** ". Every time you want to use '**test**' values, you need just recall **state.test**.
145
-
146
- ```js
147
- // Set a state
148
- state.test = "I am ready" *
149
-
150
- // Get the state
151
- state.test *
152
-
153
- // List all states
154
- state.list // or just "state" to see the proxy
155
-
156
- // Lock a state from edit (Only for Objects or Array)
157
- state.test.lock() *
158
-
159
- // Remove a state
160
- state.remove("test")
161
-
162
- // Remove all states
163
- state.removeAll()
164
-
165
- *["test" is only an example]
166
-
167
- ```
168
-
169
- ### Observer
170
-
171
- **Note**: _Observer works only with states. Stores are excluded at the moment._
172
-
173
- If you want to run a function every time a state changes, you can use:
174
-
175
- ```js
176
- /**
177
- * Observer is a non-cumulative listener,
178
- * triggered from customEvent / dispatch from state
179
- * @parameters
180
- * [ state | store, function ]
181
- */
182
- observer( "state.test", () => alert("Test Changes to: " + state.test) )
183
- |__________| |___________________________________________|
184
- State: string Function
185
-
186
- PS: you need to use the name of state | store as string
187
- ```
188
-
189
- You can use it everywhere. Works like "useState" in React but with more flexibility (use one observer for each state!).
190
-
191
- ### Example
192
-
193
- ```js
194
- import 'dphelper';
195
-
196
- // Use the observer to log the changing state value
197
- observer(
198
- 'state.count',
199
- () => console.log("State changed: ", state.count)
200
- );
201
-
202
- // Store a value in the state that changes every 5 seconds
203
- setInterval(() => state.count = Date.now(), 5000);
204
- ```
205
-
206
- > NOTE: In some cases you need to wrap inside and useEffect in React to avoid multiple observers
207
-
208
- #### Another Simple Example
209
-
210
- ```js
211
- import 'dphelper';
212
-
213
- // Set a state
214
- state.myData = 'Hello, world!';
215
-
216
- // Retrieve the state
217
- console.log(state.myData); // Output: Hello, world!
218
-
219
- // Observe state changes
220
- observer('myData', () => {
221
- console.log('myData has changed to:', state.myData);
222
- });
223
-
224
- // Change the state
225
- state.myData = 'New value';
226
- ```
227
-
228
- ## useObserver
229
-
230
- ```js
231
- import 'dphelper';
232
-
233
- // Use the useObserver to log the changing state value
234
- useObserver(
235
- () => console.log("State changed: ", state.count)
236
- , 'state.count'
237
- );
238
-
239
- // Store a value in the state that changes every 5 seconds
240
- setInterval(() => state.count = Date.now(), 5000);
241
- ```
242
-
243
- ## Store
244
-
245
- ### Persistent Storage with dpHelper
246
-
247
- When using dpHelper for permanent storage, you should use the **store**, which stores data persistently across sessions.
248
-
249
- #### Important Security Note
250
-
251
- 1. **Use store for persistent storage:** If you want to store data permanently, use store to ensure it is saved in localStorage.
252
-
253
- 2. **Remove data when necessary:** To maintain security, remove stored data when it is no longer needed, such as during logout.
254
-
255
- 3. **Remove all stored data:** Use store.removeAll() to securely remove all stored data from your application.
256
-
257
- ```js
258
- // Set a store:
259
- store.set("test", { test: "test" })
260
-
261
- // Get a store:
262
- store.get("test") // Output: { test: "test" }
263
-
264
- // Remove a store:
265
- store.remove("test") // Output: "ok"
266
-
267
- // Remove all stores:
268
- store.removeAll() // Output: "ok"
269
- ```
270
-
271
- ### 2. Example in React
272
-
273
- ```js
274
- import { useEffect } from 'react';
275
- import 'dphelper';
276
-
277
- function App() {
278
-
279
- // Store a value in the store (persistent storage)
280
- store.set(
281
- 'user',
282
- {
283
- name: 'John Doe',
284
- age: 30
285
- }
286
- );
287
-
288
- // Use the stored value in a React component
289
- useEffect(
290
- () => {
291
- console.log(store.get("user")); // Output: { name: "John Doe", age: 30 }
292
- $("#name").text(store.get("user").name)
293
- }, []
294
- );
295
-
296
- // Remove all stored data if necessary
297
- // store.removeAll();
298
-
299
- return (
300
- <div>
301
- <h1 id="name">...</h1>
302
- </div>
303
- );
304
- }
305
-
306
- export default App;
307
- ```
308
-
309
- ## session
310
-
311
- Similar to store but it's removed when you close the browser.
312
- For more performance it's better to use state over session. State is global and access to data is more faster and not require the time to resolve promises.
313
-
314
- ```js
315
- // Set a store:
316
- store.set("test", { test: "test" })
317
-
318
- // Get a store:
319
- store.get("test") // Output: { test: "test" }
320
-
321
- // Remove a store:
322
- store.remove("test") // Output: "ok"
323
-
324
- // Remove all stores:
325
- store.removeAll() // Output: "ok"
326
- ```
327
-
328
- ## Console (devtools)
329
-
330
- Type **dphelper** in the devtool console of your browser to have a look at all available tools that you can use! You can call these from everywhere without import (just one time in the main/root page).
331
-
332
- ## Browser Extension (Chrome/Edge) ♥️
333
-
334
- ![browser extension](https://img.shields.io/badge/browser%20extension-beta-orange.svg)
335
-
336
- ![dphelper Banner](https://raw.githubusercontent.com/passariello/container/refs/heads/main/dphelper/assets/images/banner.png)
337
-
338
- ![dphelper Banner](https://raw.githubusercontent.com/passariello/container/refs/heads/main/dphelper/assets/images/screenshot.png)
339
-
340
- Chrome: [Download from Google Web Store](https://chrome.google.com/webstore/detail/dphelper-manager-dev-tool/oppppldaoknfddeikfloonnialijngbk)
341
-
342
- Edge: [Download from Microsoft Addons](https://microsoftedge.microsoft.com/addons/detail/dphelper-manager-dev-to/kphabkbdpaljlfagldhojilhfammepnk)
343
-
344
- PS: **dpHelper** is compatible with all Chromium-based browsers like **Edge or Brave**!
345
-
346
- ## dpHelper Browser Extension
347
-
348
- The dpHelper browser extension allows you to manage your application's dpHelper NPM. Key features include:
349
-
350
- 1. Simplified API operations: Easily manage and manipulate data with dpHelper's collection of scripts.
351
- 2. Real-time monitoring: Track memory usage and localStorage to optimize your application's performance.
352
- 3. Stay up-to-date: Receive updates and tips to improve your daily workflow.
353
- 4. Easy installation: Simply import 'dphelper' in your project index to get started.
354
- 5. Global accessibility: All scripts are available globally and can be accessed from anywhere in your application.
355
-
356
- ## Security
357
-
358
- [Socket.dev](https://socket.dev/npm/package/dphelper)
359
-
360
- [Snyk.io](https://security.snyk.io/package/npm/dphelper)
361
-
362
- ---
363
-
364
- Dario Passariello - <dariopassariello@gmail.com>, All rights reserved - Copyright (c) 2019 - 2026
@@ -1,63 +0,0 @@
1
- # Observer
2
-
3
- ## Overview
4
-
5
- This document provides a comprehensive list of all available observer functions in the `dphelper` library along with their descriptions and examples.
6
-
7
- ## Functions
8
-
9
- ### observer([state.name], [function])
10
-
11
- - **Description:** Sets up an observer to monitor state changes and trigger a callback.
12
- - **Parameters:**
13
- - `stateName` (string): The name of the state to monitor.
14
- - `callBack` (Function): The callback function to run when the state changes.
15
- - `option` (object): Additional options for the observer.
16
- - **Example:**
17
-
18
- ```javascript
19
- observer('state.test', (newValue) => {
20
- console.log('State changed:', newValue);
21
- });
22
- ```
23
-
24
- ### observer([state.name])
25
-
26
- - **Description:** Recall the observer previously generated.
27
- - **Returns:** Console log with a note
28
- - **Example:**
29
-
30
- ```javascript
31
- observer('state.test');
32
- ```
33
-
34
- ### observer.list
35
-
36
- - **Description:** See the list of all your observer (eventListener) actually installed.
37
- - **Returns:** The list of all installed observers.
38
- - **Example:**
39
-
40
- ```javascript
41
- observer.list;
42
- ```
43
-
44
- ### remove
45
-
46
- - **Description:** Remove an observer.
47
- - **Parameters:**
48
- - `name` (string): The name of the observer to remove.
49
- - **Example:**
50
-
51
- ```javascript
52
- observer.remove('state.test');
53
- ```
54
-
55
- ### removeAll
56
-
57
- - **Description:** Remove all observers.
58
- - **Returns:** void
59
- - **Example:**
60
-
61
- ```javascript
62
- observer.removeAll();
63
- ```
@@ -1,54 +0,0 @@
1
- # dpHelper Session
2
-
3
- ## Overview
4
-
5
- This document provides a comprehensive list of all available session functions in the `dphelper` library along with their descriptions and examples.
6
-
7
- **Based on [Memorio](https://www.npmjs.com/package/memorio) by Dario Passariello** to manage STATE, STORE, SESSION and OBSERVER. You can use Memorio is you need only state management. DpHelper is indicate when you use a complete suite of tools.
8
-
9
- ## Functions
10
-
11
- ### session.get([session.name])
12
-
13
- - **Description:** Retrieve an item from session storage.
14
- - **Parameters:**
15
- - `name` (string): The name of the item to retrieve.
16
- - **Example:**
17
-
18
- ```javascript
19
- const value = session.get('itemName');
20
- console.log(value);
21
- ```
22
-
23
- ### session.set([name, value])
24
-
25
- - **Description:** Set an item in session storage.
26
- - **Parameters:**
27
- - `name` (string): The name of the item to set.
28
- - `value` (any): The value of the item to set.
29
- - **Example:**
30
-
31
- ```javascript
32
- session.set('itemName', value);
33
- ```
34
-
35
- ### session.remove([session.name])
36
-
37
- - **Description:** Delete an item from session storage.
38
- - **Parameters:**
39
- - `name` (string): The name of the item to delete.
40
- - **Example:**
41
-
42
- ```javascript
43
- session.remove('itemName');
44
- ```
45
-
46
- ### session.removeAll()
47
-
48
- - **Description:** Remove all items from session storage.
49
- - **Parameters:** None
50
- - **Example:**
51
-
52
- ```javascript
53
- session.removeAll();
54
- ```
@@ -1,65 +0,0 @@
1
- # dpHelper State
2
-
3
- ## Overview
4
-
5
- This document provides a comprehensive list of all available state functions in the `dphelper` library along with their descriptions and examples.
6
-
7
- **Based on [Memorio](https://www.npmjs.com/package/memorio) by Dario Passariello** to manage STATE, STORE, SESSION and OBSERVER. You can use Memorio is you need only state management. DpHelper is indicate when you use a complete suite of tools.
8
-
9
- ## Functions
10
-
11
- ### state.[state.name] ex: _state.test_
12
-
13
- - **Description:** Set and get state values.
14
- - **Example:**
15
-
16
- ```javascript
17
- // To set a state value
18
- state.name = 'value';
19
-
20
- // To get a state value
21
- const value = state.name;
22
- ```
23
-
24
- ### state.list
25
-
26
- - **Description:** Show all states out of proxy.
27
- - **Example:**
28
-
29
- ```javascript
30
- state.list;
31
- ```
32
-
33
- ### state.remove([state.name])
34
-
35
- - **Description:** Remove a state.
36
- - **Parameters:**
37
- - `name` (string): The name of the state to remove.
38
- - **Example:**
39
-
40
- ```javascript
41
- state.remove('stateName');
42
- ```
43
-
44
- ### state.name.lock()
45
-
46
- - **Description:** Lock a state (only for types: Array, Object).
47
- - **Example:**
48
-
49
- ```javascript
50
- state.name = {test:"test"}
51
- state.name.lock();
52
- "Now you can't add more data or remove it"
53
- ```
54
-
55
- ### state.removeAll()
56
-
57
- - **Description:** Remove all states.
58
- - **Example:**
59
-
60
- ```javascript
61
- state.name = {test:"test"}
62
- state.removeAll();
63
- "Now you can't see state.name (all states are removed)"
64
- "Use for Log-out / Sign-out operation"
65
- ```