vaniy 0.1.0 → 0.1.2
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/README.md +23 -0
- package/dist/vaniy.es.js +240 -196
- package/dist/vaniy.es.js.map +1 -1
- package/dist/vaniy.umd.js +1 -1
- package/dist/vaniy.umd.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -82,6 +82,17 @@ onPageLoad(() => console.log("DOM loaded"));
|
|
|
82
82
|
|
|
83
83
|
### HTTP
|
|
84
84
|
|
|
85
|
+
**Caching shorthand codes:**
|
|
86
|
+
|
|
87
|
+
| Rule | Description |
|
|
88
|
+
| ----- | ------------------------------ |
|
|
89
|
+
| `CFL` | cache-first + localStorage |
|
|
90
|
+
| `CFS` | cache-first + sessionStorage |
|
|
91
|
+
| `CFM` | cache-first + memory |
|
|
92
|
+
| `NFL` | network-first + localStorage |
|
|
93
|
+
| `NFS` | network-first + sessionStorage |
|
|
94
|
+
| `NFM` | network-first + memory |
|
|
95
|
+
|
|
85
96
|
HTTP client with caching, interceptors, and progress tracking.
|
|
86
97
|
|
|
87
98
|
```javascript
|
|
@@ -123,6 +134,18 @@ const data = await HTTP.get("/data", {
|
|
|
123
134
|
},
|
|
124
135
|
});
|
|
125
136
|
|
|
137
|
+
// Or with cache helper see table below for options
|
|
138
|
+
const data = await HTTP.get("/data", cache("CFL 1min"));
|
|
139
|
+
|
|
140
|
+
// This will default to CFL
|
|
141
|
+
const data = await HTTP.get("/data", cache("1min"));
|
|
142
|
+
|
|
143
|
+
// This will default to CFL 1min
|
|
144
|
+
const data = await HTTP.get("/data", cache(""));
|
|
145
|
+
|
|
146
|
+
// This will also default to CFL 1min
|
|
147
|
+
const data = await HTTP.get("/data", cache());
|
|
148
|
+
|
|
126
149
|
// File upload with progress
|
|
127
150
|
await HTTP.upload("/upload", fileInput.files[0], {
|
|
128
151
|
onProgress: (sent, total, percent) => {
|