@esvndev/es-react-config-setting 1.0.73 → 1.0.75

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/index.js CHANGED
@@ -19022,6 +19022,9 @@ const SettingApp = (props) => {
19022
19022
  };
19023
19023
 
19024
19024
  const GLOBAL_WINDOW_VARIABLE = {};
19025
+ const VARIABLE_FRIVATE = {
19026
+ FIRST_LOAD: true
19027
+ };
19025
19028
  let intervalId = null;
19026
19029
  var TIME_RELOAD = 15000;
19027
19030
  //Load interval data default
@@ -19043,6 +19046,11 @@ function base64ToBytesLength(base64String) {
19043
19046
  }
19044
19047
  //get data by key
19045
19048
  const get_conf = (key, type) => {
19049
+ if (VARIABLE_FRIVATE.FIRST_LOAD) {
19050
+ _LOAD_(null);
19051
+ VARIABLE_FRIVATE.FIRST_LOAD = false;
19052
+ return get_conf(key, type);
19053
+ }
19046
19054
  let _ = null;
19047
19055
  if (GLOBAL_WINDOW_VARIABLE && GLOBAL_WINDOW_VARIABLE[key]) {
19048
19056
  if (type === undefined) {
@@ -19102,18 +19110,18 @@ const _FETCH_AND_UPDATE = () => {
19102
19110
  };
19103
19111
  //Add variable to localstorage
19104
19112
  const _LOAD_ = (data) => {
19105
- let _ = {};
19113
+ let _ = [];
19106
19114
  if (!data) {
19107
19115
  const _json = localStorage.getItem("app_config_setting");
19108
19116
  try {
19109
- _ = JSON.parse(_json ?? '{}');
19117
+ _ = JSON.parse(_json ?? '[]');
19110
19118
  }
19111
19119
  catch (ex) { }
19112
19120
  }
19113
19121
  Object.keys(GLOBAL_WINDOW_VARIABLE).forEach(key => delete GLOBAL_WINDOW_VARIABLE[key]);
19114
19122
  try {
19115
- for (var _p in _) {
19116
- GLOBAL_WINDOW_VARIABLE[_p] = _[_p];
19123
+ for (const _p of _) {
19124
+ GLOBAL_WINDOW_VARIABLE[_p.key] = _p;
19117
19125
  }
19118
19126
  }
19119
19127
  catch (ex) { }