@cocreate/local-storage 1.13.0 → 1.14.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.14.0](https://github.com/CoCreate-app/CoCreate-local-storage/compare/v1.13.0...v1.14.0) (2024-01-17)
2
+
3
+
4
+ ### Features
5
+
6
+ * observe added nodes [localstorage-set] ([7aff443](https://github.com/CoCreate-app/CoCreate-local-storage/commit/7aff4437cd4188fffb8d570df1eb31a4218045b2))
7
+
1
8
  # [1.13.0](https://github.com/CoCreate-app/CoCreate-local-storage/compare/v1.12.0...v1.13.0) (2023-11-25)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/local-storage",
3
- "version": "1.13.0",
3
+ "version": "1.14.0",
4
4
  "description": "A Simple component similar to CoCreate-input & CoCreate-fetch which Save and fetch data for inputs, textarea, selects from localstorage. Easily configured using HTML5 attributes and/or JavaScript API",
5
5
  "keywords": [
6
6
  "local-storage",
package/src/index.js CHANGED
@@ -186,6 +186,17 @@ action.init({
186
186
  },
187
187
  })
188
188
 
189
+ observer.init({
190
+ observe: ['addedNodes'],
191
+ target: "[localstorage-set]",
192
+ callback: async function (mutation) {
193
+ let key = mutation.target.getAttribute('localstorage-set')
194
+ let value = await mutation.target.getValue()
195
+ if (key && value)
196
+ localStorage.setItem(key, value)
197
+ }
198
+ });
199
+
189
200
  CoCreateLocalStorage.checkSupport()
190
201
 
191
202
  export default CoCreateLocalStorage;