@cocreate/events 1.17.0 → 1.18.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [1.18.0](https://github.com/CoCreate-app/CoCreate-events/compare/v1.17.0...v1.18.0) (2024-01-17)
2
+
3
+
4
+ ### Features
5
+
6
+ * handle localstorage-set attribute ([663ce65](https://github.com/CoCreate-app/CoCreate-events/commit/663ce65227b3223a35576fd8618652ab21f344ca))
7
+
1
8
  # [1.17.0](https://github.com/CoCreate-app/CoCreate-events/compare/v1.16.0...v1.17.0) (2023-11-25)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/events",
3
- "version": "1.17.0",
3
+ "version": "1.18.0",
4
4
  "description": "A simple events component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "events",
package/src/index.js CHANGED
@@ -217,8 +217,13 @@ const CoCreateEvents = {
217
217
  let values
218
218
  if (prefix === 'localstorage') {
219
219
  let key = element.getAttribute('localstorage-get')
220
- if (key)
220
+ if (key) {
221
221
  values = localStorage.getItem(key)
222
+ } else if (key = element.getAttribute('localstorage-set')) {
223
+ values = await element.getValue()
224
+ if (values)
225
+ localStorage.setItem(key, values)
226
+ }
222
227
  if (!key || !values)
223
228
  return
224
229
  } else