@wildix/xbees-connect 1.1.2-alpha.3 → 1.1.2-alpha.4

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildix/xbees-connect",
3
- "version": "1.1.2-alpha.2",
3
+ "version": "1.1.2-alpha.3",
4
4
  "description": "This library provides easy communication between x-bees and integrated web applications",
5
5
  "author": "dimitri.chernykh <dimitri.chernykh@wildix.com>",
6
6
  "homepage": "",
@@ -243,11 +243,14 @@ export class Client {
243
243
  this.addEventListener(EventType.USE_THEME, callback);
244
244
  }
245
245
  getFromStorage(key) {
246
- this.localStorageManager.retrieve(key);
246
+ return this.localStorageManager.retrieve(key);
247
247
  }
248
248
  saveToStorage(key, value) {
249
249
  this.localStorageManager.save(key, value);
250
250
  }
251
+ deleteFromStorage(key) {
252
+ this.localStorageManager.delete(key);
253
+ }
251
254
  onStorage(listener) {
252
255
  this.localStorageManager.onStorage(listener);
253
256
  }
@@ -44,6 +44,10 @@ class LocalStorageManager {
44
44
  // Save data to localStorage
45
45
  localStorage.setItem(this.getStorageKey(key), JSON.stringify(value));
46
46
  }
47
+ delete(key) {
48
+ // Save data to localStorage
49
+ localStorage.removeItem(this.getStorageKey(key));
50
+ }
47
51
  retrieve(key) {
48
52
  // Retrieve data from localStorage
49
53
  const data = localStorage.getItem(this.getStorageKey(key));
@@ -51,7 +51,8 @@ export declare class Client implements ConnectClient {
51
51
  onSuggestContacts(callback: (query: string, resolve: SuggestContactsResolver, reject: Reject) => void): RemoveEventListener;
52
52
  onLookupAndMatchContact(callback: (query: ContactQuery, resolve: LookupAndMatchContactsResolver, reject: Reject) => void): RemoveEventListener;
53
53
  onThemeChange(callback: Callback<EventType.USE_THEME>): void;
54
- getFromStorage(key: string): void;
55
- saveToStorage(key: string, value: any): void;
54
+ getFromStorage<Type>(key: string): Type | null;
55
+ saveToStorage<SavingType>(key: string, value: SavingType): void;
56
+ deleteFromStorage(key: string): void;
56
57
  onStorage(listener: StorageEventCallback): void;
57
58
  }
@@ -10,6 +10,7 @@ declare class LocalStorageManager {
10
10
  private calculateIntegrationKey;
11
11
  private shouldUseIntegrationKey;
12
12
  save(key: string, value: any): void;
13
+ delete(key: string): void;
13
14
  retrieve(key: string): any;
14
15
  get(key: string): any;
15
16
  onStorage(listener: StorageEventCallback): void;
@@ -193,10 +193,13 @@ export interface ConnectClient {
193
193
  off: (callback: Callback | StorageEventCallback) => void;
194
194
  /**
195
195
  * saves data to localStorage */
196
- saveToStorage: (key: string, value: any) => void;
196
+ saveToStorage: <SavingType>(key: string, value: SavingType) => void;
197
197
  /**
198
198
  * Retrieves data from localStorage */
199
- getFromStorage: (key: string) => void;
199
+ getFromStorage: <Type>(key: string) => Type | null;
200
+ /**
201
+ * Removes data from localStorage */
202
+ deleteFromStorage: (key: string) => void;
200
203
  /**
201
204
  * listens on localStorage */
202
205
  onStorage: (listener: StorageEventCallback) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildix/xbees-connect",
3
- "version": "1.1.2-alpha.3",
3
+ "version": "1.1.2-alpha.4",
4
4
  "description": "This library provides easy communication between x-bees and integrated web applications",
5
5
  "author": "dimitri.chernykh <dimitri.chernykh@wildix.com>",
6
6
  "homepage": "",
@@ -42,5 +42,5 @@
42
42
  "engines": {
43
43
  "node": ">=16"
44
44
  },
45
- "gitHead": "7c880b978a6db592446cd5fba59f3b4bf1f94996"
45
+ "gitHead": "979e70be023f6764abb0ab2e90c49b6c7ebfb7cc"
46
46
  }