dphelper 0.0.3 → 0.0.4
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/package.json +1 -1
- package/scripts/cookie.js +11 -9
- package/scripts/indexedDB.js +19 -15
- package/scripts/storage.js +19 -17
package/package.json
CHANGED
package/scripts/cookie.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
*
|
|
2
|
+
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
+
*
|
|
4
|
+
* cookie
|
|
3
5
|
*
|
|
4
6
|
* Copyright (c) 2021, Dario Passariello.
|
|
5
7
|
* Licensed under the Apache-2.0 License.
|
|
@@ -7,15 +9,15 @@
|
|
|
7
9
|
|
|
8
10
|
/***********************************************************************/
|
|
9
11
|
|
|
10
|
-
var CookieType = "Lax";
|
|
11
|
-
var CookieSecure = "false";
|
|
12
|
-
var CookieSameSite = "false";
|
|
12
|
+
var CookieType = "Lax";
|
|
13
|
+
var CookieSecure = "false";
|
|
14
|
+
var CookieSameSite = "false";
|
|
13
15
|
|
|
14
|
-
if (location.protocol === 'https:') {
|
|
15
|
-
|
|
16
|
-
}
|
|
16
|
+
if (location.protocol === 'https:') {
|
|
17
|
+
CookieSecure = "Secure";
|
|
18
|
+
}
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
dphelper.cookie = {
|
|
19
21
|
|
|
20
22
|
// CREATE THE COOKIE
|
|
21
23
|
|
|
@@ -66,4 +68,4 @@ if (location.protocol === 'https:') {
|
|
|
66
68
|
};
|
|
67
69
|
|
|
68
70
|
// START COOKIE DB
|
|
69
|
-
|
|
71
|
+
dphelper.cookie.set( "dpHelper", 'active' );
|
package/scripts/indexedDB.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
*
|
|
2
|
+
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
+
*
|
|
4
|
+
* indexedDB
|
|
3
5
|
*
|
|
4
6
|
* Copyright (c) 2021, Dario Passariello.
|
|
5
7
|
* Licensed under the Apache-2.0 License.
|
|
@@ -7,17 +9,16 @@
|
|
|
7
9
|
|
|
8
10
|
/***********************************************************************/
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
const indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
|
|
12
|
-
|
|
13
|
-
if (!indexedDB) {
|
|
14
|
-
console.debug(e, "stPRO : Your browser doesn't support a skey version of IndexedDB. Such and such feature will not be available.");
|
|
15
|
-
console.debug( 'stPRO : Something went badly wrong with your indexedDB!' );
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
stpro.func.indexedDB = {
|
|
12
|
+
dphelper.indexedDB = {
|
|
19
13
|
|
|
20
14
|
open: ( storeName ) => {
|
|
15
|
+
|
|
16
|
+
const indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
|
|
17
|
+
|
|
18
|
+
if (!indexedDB) {
|
|
19
|
+
console.debug(e, "stPRO : Your browser doesn't support a skey version of IndexedDB. Such and such feature will not be available.");
|
|
20
|
+
console.debug( 'stPRO : Something went badly wrong with your indexedDB!' );
|
|
21
|
+
}
|
|
21
22
|
|
|
22
23
|
var request = window.indexedDB.open( storeName , 4 );
|
|
23
24
|
|
|
@@ -31,6 +32,7 @@ if (!indexedDB) {
|
|
|
31
32
|
return;
|
|
32
33
|
};
|
|
33
34
|
return request;
|
|
35
|
+
|
|
34
36
|
},
|
|
35
37
|
|
|
36
38
|
/************************************************************************/
|
|
@@ -163,14 +165,16 @@ if (!indexedDB) {
|
|
|
163
165
|
// CHECK IF INDEXEDDB EXIST
|
|
164
166
|
// ***************************************************************************************************/
|
|
165
167
|
|
|
166
|
-
|
|
168
|
+
dphelper.dbExist = () => {
|
|
167
169
|
var result = indexedDB.databases();
|
|
168
170
|
return result.length;
|
|
169
171
|
};
|
|
170
172
|
|
|
171
|
-
// START DEFAULT DB
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
// START DEFAULT DB
|
|
174
|
+
dphelper.indexedDB.open( "dpHelper" );
|
|
175
|
+
/*
|
|
176
|
+
dphelper.indexedDB.store( "dpHelper" );
|
|
177
|
+
dphelper.indexedDB.insert( "dpHelper" , 'active' , 'test[0]' , [] );
|
|
178
|
+
*/
|
|
175
179
|
|
|
176
180
|
|
package/scripts/storage.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
*
|
|
2
|
+
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
+
*
|
|
4
|
+
* storage
|
|
3
5
|
*
|
|
4
6
|
* Copyright (c) 2021, Dario Passariello.
|
|
5
7
|
* Licensed under the Apache-2.0 License.
|
|
@@ -7,22 +9,22 @@
|
|
|
7
9
|
|
|
8
10
|
/***********************************************************************/
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
dphelper.storage = {
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
get: function( name ) {
|
|
15
|
+
return localStorage.getItem( name );
|
|
16
|
+
},
|
|
17
|
+
set: function( name, value ) {
|
|
18
|
+
localStorage.setItem( name, value );
|
|
19
|
+
},
|
|
20
|
+
delete: function( name ) {
|
|
21
|
+
localStorage.removeItem( name );
|
|
22
|
+
},
|
|
23
|
+
clearAll: function() {
|
|
24
|
+
localStorage.clear();
|
|
25
|
+
}
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
};
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
// START STORAGE DB
|
|
30
|
+
dphelper.storage.set( "dpHelper", 'active' );
|