@yaasl/core 0.14.0-alpha.1 → 0.14.0-alpha.2

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.
@@ -5,11 +5,9 @@ export interface ExpirationOptions {
5
5
  expiresIn?: number | (() => number);
6
6
  }
7
7
  /** Effect to make an atom value expirable and reset to its defaulValue.
8
- *
9
- * __Note:__ When using `expiresAt`, a function returning the date should be prefered since using a static date might end in an infinite loop.
10
8
  *
11
9
  * @param {ExpirationOptions | undefined} options
12
- * @param options.expiresAt Date at which the value expires
10
+ * @param options.expiresAt Date at which the value expires. Using a function returning the date should be prefered here, since using a static date might end in an infinite loop.
13
11
  * @param options.expiresIn Milliseconds in which the value expires. Will be ignored if expiresAt is set.
14
12
  *
15
13
  * @returns The effect to be used on atoms.
@@ -15,5 +15,8 @@ export interface IndexedDbOptions {
15
15
  * @returns The effect to be used on atoms.
16
16
  **/
17
17
  export declare const indexedDb: ((...[optionsArg]: [] | [undefined] | [IndexedDbOptions]) => import("./create-effect").EffectAtomCallback<IndexedDbOptions | undefined, unknown>) & {
18
+ get: (key: string) => Promise<unknown>;
18
19
  getAllKeys: () => Promise<string[]>;
20
+ set: (key: string, value: unknown) => Promise<IDBValidKey | undefined>;
21
+ delete: (key: string) => Promise<undefined>;
19
22
  };
@@ -23,11 +23,9 @@ const syncOverBrowserTabs = (observingKey, onChange) => {
23
23
  });
24
24
  };
25
25
  /** Effect to make an atom value expirable and reset to its defaulValue.
26
- *
27
- * __Note:__ When using `expiresAt`, a function returning the date should be prefered since using a static date might end in an infinite loop.
28
26
  *
29
27
  * @param {ExpirationOptions | undefined} options
30
- * @param options.expiresAt Date at which the value expires
28
+ * @param options.expiresAt Date at which the value expires. Using a function returning the date should be prefered here, since using a static date might end in an infinite loop.
31
29
  * @param options.expiresIn Milliseconds in which the value expires. Will be ignored if expiresAt is set.
32
30
  *
33
31
  * @returns The effect to be used on atoms.
@@ -59,5 +59,8 @@ exports.indexedDb = Object.assign((0, create_effect_1.createEffect)(({ atom, opt
59
59
  },
60
60
  };
61
61
  }), {
62
+ get: (key) => getAtomDb().get(key),
62
63
  getAllKeys: () => getAtomDb().getAllKeys(),
64
+ set: (key, value) => getAtomDb().set(key, value),
65
+ delete: (key) => getAtomDb().delete(key),
63
66
  });
@@ -16,11 +16,9 @@ const syncOverBrowserTabs = (observingKey, onChange) => getWindow()?.addEventLis
16
16
  onChange(newValue);
17
17
  });
18
18
  /** Effect to make an atom value expirable and reset to its defaulValue.
19
- *
20
- * __Note:__ When using `expiresAt`, a function returning the date should be prefered since using a static date might end in an infinite loop.
21
19
  *
22
20
  * @param {ExpirationOptions | undefined} options
23
- * @param options.expiresAt Date at which the value expires
21
+ * @param options.expiresAt Date at which the value expires. Using a function returning the date should be prefered here, since using a static date might end in an infinite loop.
24
22
  * @param options.expiresIn Milliseconds in which the value expires. Will be ignored if expiresAt is set.
25
23
  *
26
24
  * @returns The effect to be used on atoms.
@@ -45,5 +45,8 @@ export const indexedDb = Object.assign(createEffect(({ atom, options }) => {
45
45
  },
46
46
  };
47
47
  }), {
48
+ get: (key) => getAtomDb().get(key),
48
49
  getAllKeys: () => getAtomDb().getAllKeys(),
50
+ set: (key, value) => getAtomDb().set(key, value),
51
+ delete: (key) => getAtomDb().delete(key),
49
52
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaasl/core",
3
- "version": "0.14.0-alpha.1",
3
+ "version": "0.14.0-alpha.2",
4
4
  "description": "yet another atomic store library (vanilla-js)",
5
5
  "author": "PrettyCoffee",
6
6
  "license": "MIT",