memorio 1.0.0 → 1.1.0
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/{dist/README.md → README.md} +27 -88
- package/{dist/index.js → index.js} +1 -1
- package/package.json +3 -3
- package/.editorconfig +0 -31
- package/.gitattributes +0 -1
- package/.github/CHANGELOG.md +0 -10
- package/.github/CITATION.cff +0 -24
- package/.github/CODEOWNERS +0 -1
- package/.github/CODE_OF_CONDUCT.md +0 -108
- package/.github/CONTRIBUTING.md +0 -108
- package/.github/COPYRIGHT.md +0 -9
- package/.github/FUNDING.yml +0 -16
- package/.github/HISTORY.md +0 -1
- package/.github/LICENSE.md +0 -21
- package/.github/README.md +0 -319
- package/.github/SECURITY.md +0 -3
- package/.github/SUMMARY.md +0 -21
- package/.github/dependabot.yml +0 -11
- package/.github/documents/OBSERVER.md +0 -72
- package/.github/documents/STATE.md +0 -72
- package/.github/documents/STORE.md +0 -84
- package/.github/pull_request_template.md +0 -27
- package/.private/npm +0 -1
- package/.vscode/extension.json +0 -15
- package/.vscode/settings.json +0 -90
- package/config/dispatch.ts +0 -49
- package/config/global.ts +0 -36
- package/coverage/clover.xml +0 -260
- package/coverage/coverage-final.json +0 -10
- package/coverage/lcov-report/a51.memorio/config/dispatch.ts.html +0 -232
- package/coverage/lcov-report/a51.memorio/config/global.ts.html +0 -193
- package/coverage/lcov-report/a51.memorio/config/index.html +0 -131
- package/coverage/lcov-report/a51.memorio/dist/config/dispatch.js.html +0 -157
- package/coverage/lcov-report/a51.memorio/dist/config/global.js.html +0 -142
- package/coverage/lcov-report/a51.memorio/dist/config/index.html +0 -131
- package/coverage/lcov-report/a51.memorio/dist/functions/cache/index.html +0 -116
- package/coverage/lcov-report/a51.memorio/dist/functions/cache/index.js.html +0 -103
- package/coverage/lcov-report/a51.memorio/dist/functions/observer/index.html +0 -116
- package/coverage/lcov-report/a51.memorio/dist/functions/observer/index.js.html +0 -280
- package/coverage/lcov-report/a51.memorio/dist/functions/state/index.html +0 -116
- package/coverage/lcov-report/a51.memorio/dist/functions/state/index.js.html +0 -460
- package/coverage/lcov-report/a51.memorio/dist/functions/store/index.html +0 -116
- package/coverage/lcov-report/a51.memorio/dist/functions/store/index.js.html +0 -367
- package/coverage/lcov-report/a51.memorio/dist/index.html +0 -116
- package/coverage/lcov-report/a51.memorio/dist/init.js.html +0 -106
- package/coverage/lcov-report/a51.memorio/functions/cache/index.html +0 -116
- package/coverage/lcov-report/a51.memorio/functions/cache/index.ts.html +0 -142
- package/coverage/lcov-report/a51.memorio/functions/observer/index.html +0 -116
- package/coverage/lcov-report/a51.memorio/functions/observer/index.ts.html +0 -448
- package/coverage/lcov-report/a51.memorio/functions/session/index.html +0 -116
- package/coverage/lcov-report/a51.memorio/functions/session/index.ts.html +0 -409
- package/coverage/lcov-report/a51.memorio/functions/state/index.html +0 -116
- package/coverage/lcov-report/a51.memorio/functions/state/index.ts.html +0 -682
- package/coverage/lcov-report/a51.memorio/functions/store/index.html +0 -116
- package/coverage/lcov-report/a51.memorio/functions/store/index.ts.html +0 -409
- package/coverage/lcov-report/a51.memorio/index.html +0 -131
- package/coverage/lcov-report/a51.memorio/index.ts.html +0 -88
- package/coverage/lcov-report/a51.memorio/init.ts.html +0 -115
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -206
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/session/index.html +0 -116
- package/coverage/lcov-report/session/index.ts.html +0 -571
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov-report/state/index.html +0 -116
- package/coverage/lcov-report/state/index.ts.html +0 -1090
- package/coverage/lcov-report/store/index.html +0 -116
- package/coverage/lcov-report/store/index.ts.html +0 -556
- package/coverage/lcov.info +0 -518
- package/dist/index.d.ts +0 -7
- package/dist/package.json +0 -98
- package/dist/types/cache.d.ts +0 -27
- package/dist/types/memorio.d.ts +0 -18
- package/dist/types/observer.d.ts +0 -47
- package/dist/types/session.d.ts +0 -91
- package/dist/types/state.d.ts +0 -71
- package/dist/types/store.d.ts +0 -91
- package/esbuild.config.mjs +0 -54
- package/eslint.config.mjs +0 -174
- package/examples/bg.jpg +0 -0
- package/examples/bootstrap.less +0 -92
- package/examples/favicon.ico +0 -0
- package/examples/index.htm +0 -65
- package/examples/javascript.js +0 -2
- package/examples/responsive.less +0 -47
- package/examples/styles.less +0 -169
- package/functions/cache/index.ts +0 -19
- package/functions/observer/index.ts +0 -121
- package/functions/session/index.ts +0 -108
- package/functions/state/index.ts +0 -199
- package/functions/store/index.ts +0 -108
- package/index.ts +0 -1
- package/init.ts +0 -12
- package/jest.config.mjs +0 -33
- package/jest.setup.js +0 -2
- package/tests/basic.test.ts +0 -50
- package/tests/cache.test.ts +0 -52
- package/tests/observer.test.ts +0 -62
- package/tests/setup.ts +0 -48
- package/tests/state.test.ts +0 -45
- package/tests/store.test.ts +0 -62
- package/tsconfig.json +0 -67
package/.github/README.md
DELETED
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
# Memorio
|
|
2
|
-
|
|
3
|
-
> A lightweight, type-safe state management library for modern JavaScript applications
|
|
4
|
-
|
|
5
|
-

|
|
6
|
-

|
|
7
|
-

|
|
8
|
-

|
|
9
|
-

|
|
10
|
-

|
|
11
|
-

|
|
12
|
-
|
|
13
|
-

|
|
14
|
-

|
|
15
|
-
|
|
16
|
-
## 📋 Table of Contents
|
|
17
|
-
|
|
18
|
-
- [Features](#features)
|
|
19
|
-
- [Installation](#installation)
|
|
20
|
-
- [Quick Start](#quick-start)
|
|
21
|
-
- [API Reference](#api-reference)
|
|
22
|
-
- [State Management](#state-management)
|
|
23
|
-
- [Observer Pattern](#observer-pattern)
|
|
24
|
-
- [Store](#store)
|
|
25
|
-
- [Session](#session)
|
|
26
|
-
- [Testing](#testing)
|
|
27
|
-
- [Security](#security)
|
|
28
|
-
- [License](#license)
|
|
29
|
-
|
|
30
|
-
## ✨ Features
|
|
31
|
-
|
|
32
|
-
- 🔄 Reactive state management with observer pattern
|
|
33
|
-
- 💾 Persistent storage with Store API
|
|
34
|
-
- ⚡ Session management for temporary data
|
|
35
|
-
- 🔒 Type-safe with full TypeScript support
|
|
36
|
-
- 🧪 Comprehensive test coverage
|
|
37
|
-
- 🎯 Zero dependencies
|
|
38
|
-
- 🔍 Easy debugging with proxy-based state
|
|
39
|
-
|
|
40
|
-
## 📦 Installation
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
npm install memorio
|
|
44
|
-
# or
|
|
45
|
-
yarn add memorio
|
|
46
|
-
# or
|
|
47
|
-
pnpm add memorio
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
✅ All test suites are passing:
|
|
51
|
-
|
|
52
|
-
- Basic functionality tests
|
|
53
|
-
- State management tests
|
|
54
|
-
- Store operations tests
|
|
55
|
-
- Cache operations tests
|
|
56
|
-
- Observer pattern tests
|
|
57
|
-
|
|
58
|
-
Total: 25 tests passed across 5 test suites
|
|
59
|
-
|
|
60
|
-
## 🚀 Quick Start
|
|
61
|
-
|
|
62
|
-
```javascript
|
|
63
|
-
import 'memorio';
|
|
64
|
-
|
|
65
|
-
// State Management
|
|
66
|
-
state.counter = 0;
|
|
67
|
-
state.user = { name: 'John', age: 30 };
|
|
68
|
-
|
|
69
|
-
// Observer Pattern
|
|
70
|
-
observer('state.counter', (newValue, oldValue) => {
|
|
71
|
-
console.log(`Counter changed from ${oldValue} to ${newValue}`);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
// Store (Persistent Storage)
|
|
75
|
-
store.set('preferences', { theme: 'dark' });
|
|
76
|
-
const preferences = store.get('preferences');
|
|
77
|
-
|
|
78
|
-
// Session Storage
|
|
79
|
-
session.set('token', 'user-jwt-token');
|
|
80
|
-
const token = session.get('token');
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## 📖 API Reference
|
|
84
|
-
|
|
85
|
-
### State Management
|
|
86
|
-
|
|
87
|
-
State in Memorio is globally accessible and reactive:
|
|
88
|
-
|
|
89
|
-
```javascript
|
|
90
|
-
// Setting state
|
|
91
|
-
state.user = { name: 'John' };
|
|
92
|
-
|
|
93
|
-
// Getting state
|
|
94
|
-
const userName = state.user.name;
|
|
95
|
-
|
|
96
|
-
// Listing all states
|
|
97
|
-
console.log(state.list);
|
|
98
|
-
|
|
99
|
-
// Locking state (for Objects or Arrays)
|
|
100
|
-
state.user.lock();
|
|
101
|
-
|
|
102
|
-
// Removing state
|
|
103
|
-
state.remove('user');
|
|
104
|
-
|
|
105
|
-
// Clearing all states
|
|
106
|
-
state.removeAll();
|
|
107
|
-
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### Observer Pattern
|
|
111
|
-
|
|
112
|
-
Observe state changes with React-like syntax:
|
|
113
|
-
|
|
114
|
-
```javascript
|
|
115
|
-
// Basic observer
|
|
116
|
-
observer('state.user', (newValue, oldValue) => {
|
|
117
|
-
console.log('User updated:', newValue);
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
// With React useState
|
|
121
|
-
const [user, setUser] = useState();
|
|
122
|
-
observer('state.user', () => {
|
|
123
|
-
setUser(state.user);
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
// With React useEffect
|
|
127
|
-
useEffect(() => {
|
|
128
|
-
console.log('User changed:', state.user);
|
|
129
|
-
}, [state.user]);
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### Another example of use of Observer
|
|
133
|
-
|
|
134
|
-
```js
|
|
135
|
-
import 'memorio';
|
|
136
|
-
|
|
137
|
-
// Use the observer to log the changing state value
|
|
138
|
-
observer(
|
|
139
|
-
'state.count',
|
|
140
|
-
() => console.log("State changed: ", state.count)
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
// Store a value in the state that changes every 5 seconds
|
|
144
|
-
setInterval(() => state.count = Date.now(), 5000);
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
---
|
|
148
|
-
|
|
149
|
-
## STORE
|
|
150
|
-
|
|
151
|
-
```js
|
|
152
|
-
// Set a store:
|
|
153
|
-
store.set("test", { test: "test" })
|
|
154
|
-
|
|
155
|
-
// Get a store:
|
|
156
|
-
store.get("test") // Output: { test: "test" }
|
|
157
|
-
|
|
158
|
-
// Remove a store:
|
|
159
|
-
store.remove("test") // Output: "ok"
|
|
160
|
-
|
|
161
|
-
// Remove all stores:
|
|
162
|
-
store.removeAll() // Output: "ok"
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
### Store
|
|
166
|
-
|
|
167
|
-
Persistent storage for your application:
|
|
168
|
-
|
|
169
|
-
```javascript
|
|
170
|
-
// Setting values
|
|
171
|
-
store.set('config', { theme: 'dark', language: 'en' });
|
|
172
|
-
|
|
173
|
-
// Getting values
|
|
174
|
-
const config = store.get('config');
|
|
175
|
-
|
|
176
|
-
// Removing specific value
|
|
177
|
-
store.remove('config');
|
|
178
|
-
|
|
179
|
-
// Getting store size
|
|
180
|
-
const size = store.size();
|
|
181
|
-
|
|
182
|
-
// Clearing store
|
|
183
|
-
store.removeAll();
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
### Session
|
|
187
|
-
|
|
188
|
-
Temporary storage that persists during page sessions:
|
|
189
|
-
|
|
190
|
-
```javascript
|
|
191
|
-
// Setting session data
|
|
192
|
-
session.set('userSession', {
|
|
193
|
-
id: 'user123',
|
|
194
|
-
lastActive: Date.now()
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
// Getting session data
|
|
198
|
-
const userData = session.get('userSession');
|
|
199
|
-
|
|
200
|
-
// Checking session size
|
|
201
|
-
const activeItems = session.size();
|
|
202
|
-
|
|
203
|
-
// Removing session data
|
|
204
|
-
session.remove('userSession');
|
|
205
|
-
|
|
206
|
-
// Clearing all session data
|
|
207
|
-
session.removeAll();
|
|
208
|
-
|
|
209
|
-
// Remove all stored data if necessary
|
|
210
|
-
// store.removeAll();
|
|
211
|
-
|
|
212
|
-
return (
|
|
213
|
-
<div>
|
|
214
|
-
<h1 id="name">...</h1>
|
|
215
|
-
</div>
|
|
216
|
-
);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
export default App;
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
---
|
|
223
|
-
|
|
224
|
-
## SESSION
|
|
225
|
-
|
|
226
|
-
Session storage provides a way to store data for the duration of a page session. The data persists as long as the browser is open and survives over page reloads, but is lost when the browser tab or window is closed.
|
|
227
|
-
|
|
228
|
-
```js
|
|
229
|
-
// Set a session value:
|
|
230
|
-
session.set("userId", "12345")
|
|
231
|
-
|
|
232
|
-
// Get a session value:
|
|
233
|
-
session.get("userId") // Output: "12345"
|
|
234
|
-
|
|
235
|
-
// Remove a specific session value:
|
|
236
|
-
session.remove("userId")
|
|
237
|
-
|
|
238
|
-
// Get the number of items in session:
|
|
239
|
-
session.size() // Output: number of stored items
|
|
240
|
-
|
|
241
|
-
// Remove all session values:
|
|
242
|
-
session.removeAll()
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
### Example use Session in React
|
|
246
|
-
|
|
247
|
-
```js
|
|
248
|
-
import { useEffect } from 'react';
|
|
249
|
-
import 'memorio';
|
|
250
|
-
|
|
251
|
-
function UserSession() {
|
|
252
|
-
useEffect(() => {
|
|
253
|
-
// Store user session data
|
|
254
|
-
session.set('userSession', {
|
|
255
|
-
id: '12345',
|
|
256
|
-
lastActive: Date.now(),
|
|
257
|
-
preferences: {
|
|
258
|
-
theme: 'dark',
|
|
259
|
-
language: 'en'
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
// Retrieve session data
|
|
264
|
-
const userData = session.get('userSession');
|
|
265
|
-
console.log('User session:', userData);
|
|
266
|
-
|
|
267
|
-
// Clean up on component unmount
|
|
268
|
-
return () => {
|
|
269
|
-
session.remove('userSession');
|
|
270
|
-
};
|
|
271
|
-
}, []);
|
|
272
|
-
|
|
273
|
-
return (
|
|
274
|
-
<div>
|
|
275
|
-
{/* Your component JSX */}
|
|
276
|
-
</div>
|
|
277
|
-
);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
export default UserSession;
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
---
|
|
284
|
-
|
|
285
|
-
## 🧪 Testing
|
|
286
|
-
|
|
287
|
-
✅ All test suites are passing:
|
|
288
|
-
|
|
289
|
-
- Basic functionality tests
|
|
290
|
-
- State management tests
|
|
291
|
-
- Store operations tests
|
|
292
|
-
- Cache operations tests
|
|
293
|
-
- Observer pattern tests
|
|
294
|
-
|
|
295
|
-
Total: 25 tests passed across 5 test suites
|
|
296
|
-
|
|
297
|
-
## 🔒 Security
|
|
298
|
-
|
|
299
|
-
Security scans and reports are available at:
|
|
300
|
-
- [Socket.dev](https://socket.dev/npm/package/memorio)
|
|
301
|
-
- [Snyk.io](https://security.snyk.io/package/npm/memorio)
|
|
302
|
-
|
|
303
|
-
## 📄 License
|
|
304
|
-
|
|
305
|
-
MIT © [Dario Passariello](https://dario.passariello.ca/)
|
|
306
|
-
|
|
307
|
-
---
|
|
308
|
-
|
|
309
|
-
## 🤝 Contributing
|
|
310
|
-
|
|
311
|
-
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
312
|
-
|
|
313
|
-
## 📧 Support
|
|
314
|
-
|
|
315
|
-
Need help? Feel free to [open an issue](https://github.com/a51-dev/a51.memorio/issues).
|
|
316
|
-
|
|
317
|
-
---
|
|
318
|
-
|
|
319
|
-
Created with ❤️ by [Dario Passariello](https://dario.passariello.ca/) - Copyright © 2025
|
package/.github/SECURITY.md
DELETED
package/.github/SUMMARY.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# Table of contents
|
|
2
|
-
|
|
3
|
-
* [README](README.md)
|
|
4
|
-
|
|
5
|
-
## General
|
|
6
|
-
|
|
7
|
-
* [State](/documents/STATE.md)
|
|
8
|
-
* [Observer](/documents/OBSERVER.md)
|
|
9
|
-
* [Store](/documents/STORE.md)
|
|
10
|
-
|
|
11
|
-
## documents
|
|
12
|
-
|
|
13
|
-
* [License](LICENSE.md)
|
|
14
|
-
* [Contributing](CONTRIBUTING.md)
|
|
15
|
-
* [Code of Conduct](CODE_OF_CONDUCT.md)
|
|
16
|
-
* [Security](SECURITY.md)
|
|
17
|
-
|
|
18
|
-
## changes
|
|
19
|
-
|
|
20
|
-
* [Changelog](CAHNGELOG.md)
|
|
21
|
-
* [History](HISTORY.md)
|
package/.github/dependabot.yml
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
-
# package ecosystems to update and where the package manifests are located.
|
|
3
|
-
# Please see the documentation for all configuration options:
|
|
4
|
-
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
|
5
|
-
|
|
6
|
-
version: 2
|
|
7
|
-
updates:
|
|
8
|
-
- package-ecosystem: "npm" # See documentation for possible values
|
|
9
|
-
directory: "/" # Location of package manifests
|
|
10
|
-
schedule:
|
|
11
|
-
interval: "daily"
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
# Observer
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
This document provides a comprehensive list of all available observer functions in the `memorio` 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
|
-
|
|
17
|
-
- **Example:**
|
|
18
|
-
|
|
19
|
-
```javascript
|
|
20
|
-
observer('state.test', (newValue) => {
|
|
21
|
-
console.log('State changed:', newValue);
|
|
22
|
-
});
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### observer([state.name])
|
|
26
|
-
|
|
27
|
-
- **Description:** Recall the observer previously generated.
|
|
28
|
-
- **Returns:** Console log with a note
|
|
29
|
-
|
|
30
|
-
- **Example:**
|
|
31
|
-
|
|
32
|
-
```javascript
|
|
33
|
-
observer('state.test');
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### observer.list
|
|
37
|
-
|
|
38
|
-
- **Description:** See the list of all your observer (eventListener) actually installed.
|
|
39
|
-
- **Returns:** The list of all installed observers.
|
|
40
|
-
|
|
41
|
-
- **Example:**
|
|
42
|
-
|
|
43
|
-
```javascript
|
|
44
|
-
observer.list;
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### remove
|
|
48
|
-
|
|
49
|
-
- **Description:** Remove an observer.
|
|
50
|
-
- **Parameters:**
|
|
51
|
-
- `name` (string): The name of the observer to remove.
|
|
52
|
-
|
|
53
|
-
- **Example:**
|
|
54
|
-
|
|
55
|
-
```javascript
|
|
56
|
-
observer.remove('state.test');
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### removeAll
|
|
60
|
-
|
|
61
|
-
- **Description:** Remove all observers.
|
|
62
|
-
- **Returns:** void
|
|
63
|
-
|
|
64
|
-
- **Example:**
|
|
65
|
-
|
|
66
|
-
```javascript
|
|
67
|
-
observer.removeAll();
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## License
|
|
71
|
-
|
|
72
|
-
This project is licensed under the MIT License.
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
# memorio State
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
This document provides a comprehensive list of all available state functions in the `memorio` library along with their descriptions and examples.
|
|
6
|
-
|
|
7
|
-
## Functions
|
|
8
|
-
|
|
9
|
-
### state.[state.name] ex: _state.test_
|
|
10
|
-
|
|
11
|
-
- **Description:** Set and get state values.
|
|
12
|
-
|
|
13
|
-
- **Example:**
|
|
14
|
-
|
|
15
|
-
```javascript
|
|
16
|
-
// To set a state value
|
|
17
|
-
state.name = 'value';
|
|
18
|
-
|
|
19
|
-
// To get a state value
|
|
20
|
-
const value = state.name;
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### state.list
|
|
24
|
-
|
|
25
|
-
- **Description:** Show all states out of proxy.
|
|
26
|
-
|
|
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
|
-
|
|
39
|
-
- **Example:**
|
|
40
|
-
|
|
41
|
-
```javascript
|
|
42
|
-
state.remove('stateName');
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### state.name.lock()
|
|
46
|
-
|
|
47
|
-
- **Description:** Lock a state (only for types: Array, Object).
|
|
48
|
-
|
|
49
|
-
- **Example:**
|
|
50
|
-
|
|
51
|
-
```javascript
|
|
52
|
-
state.name = {test:"test"}
|
|
53
|
-
state.name.lock();
|
|
54
|
-
"Now you can't add more data or remove it"
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### state.removeAll()
|
|
58
|
-
|
|
59
|
-
- **Description:** Remove all states.
|
|
60
|
-
|
|
61
|
-
- **Example:**
|
|
62
|
-
|
|
63
|
-
```javascript
|
|
64
|
-
state.name = {test:"test"}
|
|
65
|
-
state.removeAll();
|
|
66
|
-
"Now you can't see state.name (all states are removed)"
|
|
67
|
-
"Use for Log-out / Sign-out operation"
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## License
|
|
71
|
-
|
|
72
|
-
This project is licensed under the MIT License.
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
# memorio Store
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
This document provides a comprehensive list of all available store functions in the `memorio` library along with their descriptions and examples.
|
|
6
|
-
|
|
7
|
-
## Functions
|
|
8
|
-
|
|
9
|
-
### store.get([store.name])
|
|
10
|
-
|
|
11
|
-
- **Description:** Retrieve an item from local storage.
|
|
12
|
-
- **Parameters:**
|
|
13
|
-
- `name` (string): The name of the item to retrieve.
|
|
14
|
-
|
|
15
|
-
- **Example:**
|
|
16
|
-
|
|
17
|
-
```javascript
|
|
18
|
-
const value = store.get('itemName');
|
|
19
|
-
console.log(value);
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
### store.set([name, value])
|
|
23
|
-
|
|
24
|
-
- **Description:** Set an item in local storage.
|
|
25
|
-
- **Parameters:**
|
|
26
|
-
- `name` (string): The name of the item to set.
|
|
27
|
-
- `value` (any): The value of the item to set.
|
|
28
|
-
|
|
29
|
-
- **Example:**
|
|
30
|
-
|
|
31
|
-
```javascript
|
|
32
|
-
store.set('itemName', value);
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### store.remove([store.name])
|
|
36
|
-
|
|
37
|
-
- **Description:** Delete an item from local storage.
|
|
38
|
-
- **Parameters:**
|
|
39
|
-
- `name` (string): The name of the item to delete.
|
|
40
|
-
|
|
41
|
-
- **Example:**
|
|
42
|
-
|
|
43
|
-
```javascript
|
|
44
|
-
store.remove('itemName');
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### store.removeAll()
|
|
48
|
-
|
|
49
|
-
- **Description:** Remove all items from local storage.
|
|
50
|
-
- **Parameters:** None
|
|
51
|
-
|
|
52
|
-
- **Example:**
|
|
53
|
-
|
|
54
|
-
```javascript
|
|
55
|
-
store.removeAll();
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### store.quota()
|
|
59
|
-
|
|
60
|
-
- **Description:** Estimate the storage quota and usage.
|
|
61
|
-
- **Parameters:** None
|
|
62
|
-
|
|
63
|
-
- **Example:**
|
|
64
|
-
|
|
65
|
-
```javascript
|
|
66
|
-
const quota = store.quota();
|
|
67
|
-
console.log(quota);
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### store.size()
|
|
71
|
-
|
|
72
|
-
- **Description:** Calculate the total size of all items in local storage.
|
|
73
|
-
- **Parameters:** None
|
|
74
|
-
|
|
75
|
-
- **Example:**
|
|
76
|
-
|
|
77
|
-
```javascript
|
|
78
|
-
const totalSize = store.size();
|
|
79
|
-
console.log(totalSize);
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
## License
|
|
83
|
-
|
|
84
|
-
This project is licensed under the MIT License.
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
## Description
|
|
2
|
-
|
|
3
|
-
1. What is this PR about (link the issue and add a short description)
|
|
4
|
-
|
|
5
|
-
## Steps for reproduction
|
|
6
|
-
|
|
7
|
-
1. click button
|
|
8
|
-
2. expect xyz
|
|
9
|
-
|
|
10
|
-
## Code Review
|
|
11
|
-
|
|
12
|
-
- [ ] hi, I need you to do
|
|
13
|
-
- conceptual review (architecture, feature-correctness)
|
|
14
|
-
- detailed review (read every line)
|
|
15
|
-
- test it on preview
|
|
16
|
-
|
|
17
|
-
## Before requesting a review
|
|
18
|
-
|
|
19
|
-
- [ ] made a self-review
|
|
20
|
-
- [ ] added inline comments where things may be not obvious (the "why", not "what")
|
|
21
|
-
|
|
22
|
-
## Before merging
|
|
23
|
-
|
|
24
|
-
- [ ] tested locally and on preview environment (preview dev login: 0000)
|
|
25
|
-
- [ ] updated [test cases] document
|
|
26
|
-
- [ ] added tests
|
|
27
|
-
- [ ] if any new env variables are added, added them to `.env` file
|
package/.private/npm
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
npm deprecate memorio@"< 0.2.0" "critical bug fixed and improvements"
|
package/.vscode/extension.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"recommendations": [
|
|
3
|
-
"alefragnani.project-manager",
|
|
4
|
-
"donjayamanne.githistory",
|
|
5
|
-
"mhutchie.git-graph",
|
|
6
|
-
"mgmcdermott.vscode-language-babel",
|
|
7
|
-
"eamodio.gitlens",
|
|
8
|
-
"ms-vscode.vscode-typescript-next",
|
|
9
|
-
"ms-vscode.js-debug-nightly",
|
|
10
|
-
"pkief.material-icon-theme",
|
|
11
|
-
"jock.svg",
|
|
12
|
-
"simonsiefke.svg-preview",
|
|
13
|
-
"dbaeumer.vscode-eslint"
|
|
14
|
-
]
|
|
15
|
-
}
|