
Manager | DevTools by Dario Passariello (c)






Table of Contents
About
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.
-
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.
-
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.
-
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.
-
Based on 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.
1. Example in React
import { useEffect } from 'react';
import 'dphelper';
function App() {
state.test = 'Hello, World!';
useEffect(() => {
console.log("You can recall from all pages: " + state.test);
}, []);
return (
<div>
<h1>{state.test}</h1>
</div>
);
}
export default App;
Install
Install dpHelper.
npm i dphelper --save-dev
or update:
npm i dphelper@latest --save-dev
Use it in the main root file (and only there):
import "dphelper";
or
require("dphelper");
Install for EJS or Other Types of Projects (like HTML)
Note: You don't need to use npm install in this case, or you will get an error.
<script src="https://cdn.jsdelivr.net/npm/dphelper"></script>
Live Demo
https://tests.a51.dev/
You can see an HTML version where dpHelper and LayerPro work together seamlessly. dpHelper is compatible with a variety of frontend libraries, including:
- HTML
- React
- Vue
- And any other frontend library
Documentation
You can see:
You can see more tutorials, information, and examples about dpHelper clicking here.
State
Using the "state" Function
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.
For example, you can store a value like this: state.test = 'I am ready' and then retrieve it later using state.test.
example:
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.
state.test = "I am ready" *
state.test *
state.list
state.test.lock() *
state.remove("test")
state.removeAll()
*["test" is only an example]
Observer
Note: Observer works only with states. Stores are excluded at the moment.
If you want to run a function every time a state changes, you can use:
observer( "state.test", () => alert("Test Changes to: " + state.test) )
|__________| |___________________________________________|
State: string Function
PS: you need to use the name of state | store as string
You can use it everywhere. Works like "useState" in React but with more flexibility (use one observer for each state!).
Example
import 'dphelper';
observer(
'state.count',
() => console.log("State changed: ", state.count)
);
setInterval(() => state.count = Date.now(), 5000);
NOTE: In some cases you need to wrap inside and useEffect in React to avoid multiple observers
Another Simple Example
import 'dphelper';
state.myData = 'Hello, world!';
console.log(state.myData);
observer('myData', () => {
console.log('myData has changed to:', state.myData);
});
state.myData = 'New value';
useObserver
import 'dphelper';
useObserver(
() => console.log("State changed: ", state.count)
, 'state.count'
);
setInterval(() => state.count = Date.now(), 5000);
Store
Persistent Storage with dpHelper
When using dpHelper for permanent storage, you should use the store, which stores data persistently across sessions.
Important Security Note
-
Use store for persistent storage: If you want to store data permanently, use store to ensure it is saved in localStorage.
-
Remove data when necessary: To maintain security, remove stored data when it is no longer needed, such as during logout.
-
Remove all stored data: Use store.removeAll() to securely remove all stored data from your application.
store.set("test", { test: "test" })
store.get("test")
store.remove("test")
store.removeAll()
2. Example in React
import { useEffect } from 'react';
import 'dphelper';
function App() {
store.set(
'user',
{
name: 'John Doe',
age: 30
}
);
useEffect(
() => {
console.log(store.get("user"));
$("#name").text(store.get("user").name)
}, []
);
return (
<div>
<h1 id="name">...</h1>
</div>
);
}
export default App;
session
Similar to store but it's removed when you close the browser.
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.
store.set("test", { test: "test" })
store.get("test")
store.remove("test")
store.removeAll()
Extension
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).
Browser Extension (Chrome/Edge) ♥️



Chrome: Download from Google Web Store
Edge: Download from Microsoft Addons
PS: dpHelper is compatible with all Chromium-based browsers like Edge or Brave!
dpHelper Browser Extension
The dpHelper browser extension allows you to manage your application's dpHelper NPM. Key features include:
- Simplified API operations: Easily manage and manipulate data with dpHelper's collection of scripts.
- Real-time monitoring: Track memory usage and localStorage to optimize your application's performance.
- Stay up-to-date: Receive updates and tips to improve your daily workflow.
- Easy installation: Simply import 'dphelper' in your project index to get started.
- Global accessibility: All scripts are available globally and can be accessed from anywhere in your application.
Security
Socket.dev
Snyk.io
License
MIT - https://en.wikipedia.org/wiki/MIT_License
Dario Passariello - dariopassariello@gmail.com, All rights reserved - Copyright (c) 2019 - 2025