chayns-api 2.3.0-beta.0 → 2.3.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.
@@ -86,7 +86,13 @@ async function addAppStorageListener(storeName, prefix, callback) {
86
86
  const handleValue = value => {
87
87
  var _value$key;
88
88
  if (value.action === 0 && (_value$key = value.key) !== null && _value$key !== void 0 && _value$key.startsWith(prefix)) {
89
- callback(value);
89
+ let data = value.value;
90
+ try {
91
+ if (typeof data === 'string') {
92
+ data = JSON.parse(data);
93
+ }
94
+ } catch {}
95
+ callback(data);
90
96
  void removeAppStorageItem.call(this, storeName, value.key);
91
97
  }
92
98
  };
@@ -75,7 +75,13 @@ export async function addAppStorageListener(storeName, prefix, callback) {
75
75
  const handleValue = value => {
76
76
  var _value$key;
77
77
  if (value.action === 0 && (_value$key = value.key) !== null && _value$key !== void 0 && _value$key.startsWith(prefix)) {
78
- callback(value);
78
+ let data = value.value;
79
+ try {
80
+ if (typeof data === 'string') {
81
+ data = JSON.parse(data);
82
+ }
83
+ } catch {}
84
+ callback(data);
79
85
  void removeAppStorageItem.call(this, storeName, value.key);
80
86
  }
81
87
  };
@@ -4,8 +4,4 @@ export declare function getAppStorageItem<T extends unknown>(this: AppWrapper, s
4
4
  export declare function setAppStorageItem<T extends string | object>(this: AppWrapper, storeName: string, key: string, value: T): Promise<void>;
5
5
  export declare function removeAppStorageItem(this: AppWrapper, storeName: string, key: string): void;
6
6
  export declare function clearAppStorage(this: AppWrapper, storeName: string): void;
7
- export declare function addAppStorageListener<T extends string | object>(this: AppWrapper, storeName: string, prefix: string, callback: (value: {
8
- key?: string;
9
- value?: T;
10
- action: number;
11
- }) => void): Promise<void>;
7
+ export declare function addAppStorageListener<T extends string | object>(this: AppWrapper, storeName: string, prefix: string, callback: (value: T | undefined) => void): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chayns-api",
3
- "version": "2.3.0-beta.0",
3
+ "version": "2.3.0",
4
4
  "description": "new chayns api",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",