@ombori/ga-settings
Advanced tools
Comparing version 3.92.13 to 4.0.1
@@ -6,2 +6,24 @@ # Change Log | ||
## 4.0.1 (2024-08-24) | ||
### Bug Fixes | ||
* deps ([b4f1925](https://github.com/ombori/gridapp/commit/b4f1925d08d3977d4d7dfdacddfad3696f0f8f65)) | ||
## [3.93.1](https://github.com/ombori/gridapp/compare/v3.92.13...v3.93.1) (2024-08-24) | ||
### Bug Fixes | ||
* support loading settings from localstorage in ga-settings ([b2dc636](https://github.com/ombori/gridapp/commit/b2dc6360fb730a6c80ca64cea732cf901c6097b2)) | ||
## 3.92.13 (2024-05-30) | ||
@@ -8,0 +30,0 @@ |
@@ -128,5 +128,31 @@ "use strict"; | ||
}; | ||
var localStorageGridAppSettings = window.localStorage.getItem('gridappSettings'); | ||
if (utils_1.isDev) { | ||
setSettings(getDevSettings(props.devSettings)); | ||
} | ||
else if (localStorageGridAppSettings) { | ||
log('Settings localStorageGridAppSettings production mode'); | ||
window.addEventListener('GridappReady', handler); | ||
try { | ||
var localStorageSettings_1 = JSON.parse(localStorageGridAppSettings); | ||
window.gridParams = { | ||
settings: localStorageSettings_1, | ||
}; | ||
window.gridapp = { | ||
addEventListener: function (event, listener) { | ||
window.addEventListener(event, listener); | ||
}, | ||
removeEventListener: function (event, listener) { | ||
window.removeEventListener(event, listener); | ||
}, | ||
getSettings: function () { return localStorageSettings_1; }, | ||
}; | ||
window.dispatchEvent(new CustomEvent('ready')); | ||
window.dispatchEvent(new Event('GridappReady')); | ||
} | ||
catch (err) { | ||
// no action | ||
} | ||
// TODO: here we can check if the app settings exist in localstorage, and if it does we can directly use it in handler and not wait for the event | ||
} | ||
else { | ||
@@ -140,2 +166,3 @@ log('Settings production mode'); | ||
} | ||
// TODO: here we can check if the app settings exist in localstorage, and if it does we can directly use it in handler and not wait for the event | ||
window.addEventListener('GridappReady', handler); | ||
@@ -142,0 +169,0 @@ } |
{ | ||
"name": "@ombori/ga-settings", | ||
"version": "3.92.13", | ||
"version": "4.0.1", | ||
"main": "dist/index.js", | ||
@@ -19,3 +19,3 @@ "license": "UNLICENSED", | ||
"test:coverage": "npm run test -- --coverage --watchAll=false", | ||
"gitHead": "1e0caf5875b06e1daa14a48a8f7c7a3e422d3752" | ||
"gitHead": "98019239a6cacdaee0e46cda6e4ab5e93ba29eb8" | ||
} |
@@ -138,4 +138,29 @@ import { useEffect, useState, useRef } from 'react'; | ||
const localStorageGridAppSettings = window.localStorage.getItem('gridappSettings'); | ||
if (isDev) { | ||
setSettings(getDevSettings(props.devSettings)); | ||
} else if (localStorageGridAppSettings) { | ||
log('Settings localStorageGridAppSettings production mode'); | ||
window.addEventListener('GridappReady', handler); | ||
try { | ||
const localStorageSettings = JSON.parse(localStorageGridAppSettings); | ||
(window as any).gridParams = { | ||
settings: localStorageSettings, | ||
}; | ||
window.gridapp = { | ||
addEventListener: (event: any, listener: any) => { | ||
window.addEventListener(event, listener); | ||
}, | ||
removeEventListener: (event: any, listener: any) => { | ||
window.removeEventListener(event, listener); | ||
}, | ||
getSettings: () => localStorageSettings, | ||
}; | ||
window.dispatchEvent(new CustomEvent('ready')); | ||
window.dispatchEvent(new Event('GridappReady')); | ||
} catch (err) { | ||
// no action | ||
} | ||
// TODO: here we can check if the app settings exist in localstorage, and if it does we can directly use it in handler and not wait for the event | ||
} else { | ||
@@ -148,3 +173,3 @@ log('Settings production mode'); | ||
} | ||
// TODO: here we can check if the app settings exist in localstorage, and if it does we can directly use it in handler and not wait for the event | ||
window.addEventListener('GridappReady', handler); | ||
@@ -151,0 +176,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69280
1102