puvox-library 1.0.49 → 1.0.51
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/library_standard.js +9 -4
- package/package.json +1 -1
package/library_standard.js
CHANGED
@@ -2890,7 +2890,8 @@ const puvox_library =
|
|
2890
2890
|
helper_read(groupName, storageType, expireSeconds = 0){
|
2891
2891
|
const appName = puvox_library.getAppName();
|
2892
2892
|
if (storageType === 'file'){
|
2893
|
-
const
|
2893
|
+
const dir = puvox_library.file.tempDir() + appName + '/';
|
2894
|
+
const filepath = dir + groupName + '.json';
|
2894
2895
|
// todo: add expiration
|
2895
2896
|
return puvox_library.file.read(filepath);
|
2896
2897
|
} else if (storageType === 'localStorage') {
|
@@ -2911,9 +2912,12 @@ const puvox_library =
|
|
2911
2912
|
}
|
2912
2913
|
},
|
2913
2914
|
helper_write(groupName, content, storageType){
|
2915
|
+
content = puvox_library.isString (content) ? content : (puvox_library.isArray(content) || puvox_library.isObject(content) ? JSON.stringify(content) : content);
|
2914
2916
|
const appName = puvox_library.getAppName();
|
2915
2917
|
if (storageType === 'file'){
|
2916
|
-
const
|
2918
|
+
const dir = puvox_library.file.tempDir() + appName + '/';
|
2919
|
+
puvox_library.file.createDirectory(dir);
|
2920
|
+
const filepath = dir + groupName + '.json';
|
2917
2921
|
// todo: add expiration
|
2918
2922
|
puvox_library.file.write(filepath, content);
|
2919
2923
|
return true;
|
@@ -2933,7 +2937,7 @@ const puvox_library =
|
|
2933
2937
|
helper_delete(groupName, storageType){
|
2934
2938
|
const appName = puvox_library.getAppName();
|
2935
2939
|
if (storageType === 'file'){
|
2936
|
-
const filepath = puvox_library.file.tempDir() + appName + '
|
2940
|
+
const filepath = puvox_library.file.tempDir() + appName + '/' + groupName + '.json';
|
2937
2941
|
// todo: better delete
|
2938
2942
|
puvox_library.file.delete(filepath);
|
2939
2943
|
return true;
|
@@ -2990,7 +2994,7 @@ const puvox_library =
|
|
2990
2994
|
if (!this.customCacheDir){
|
2991
2995
|
this.customCacheDir = puvox_library.file.tempDir();
|
2992
2996
|
}
|
2993
|
-
let finaldir = puvox_library.trailingSlash(this.customCacheDir +
|
2997
|
+
let finaldir = puvox_library.trailingSlash(this.customCacheDir + puvox_library.getAppName() + '_cache_');
|
2994
2998
|
return finaldir;
|
2995
2999
|
},
|
2996
3000
|
set_dir(dir, auto_clear_seconds=null){
|
@@ -3370,6 +3374,7 @@ const puvox_library =
|
|
3370
3374
|
(object.length >= 2) &&
|
3371
3375
|
((object[0] === '{') || (object[0] === '['))
|
3372
3376
|
),
|
3377
|
+
//htmlentities
|
3373
3378
|
encode_html_entities (content) {
|
3374
3379
|
return content.replace(/[\u00A0-\u9999<>\&]/g, function(i) {
|
3375
3380
|
return '&#'+i.charCodeAt(0)+';';
|