@cripty2001/utils 0.0.186 → 0.0.187

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.
@@ -31,7 +31,7 @@ export declare function useWhispr<T>(data: T | Whispr<T>): Whispr<T>;
31
31
  * @param cb The callback to call on value change
32
32
  * @param unsafe If true, the callback will be allowed to throw errors, that will then bubble up
33
33
  */
34
- export declare function useOnWhispr<T>(w: Whispr<T>, unsafe: boolean | undefined, cb: (value: T) => void): void;
34
+ export declare function useOnWhispr<T>(w: Whispr<T>, cb: (value: T) => void, unsafe?: boolean): void;
35
35
  /**
36
36
  * Return a reactive current timestamp (ms)
37
37
  * @returns The current timestamp
@@ -75,7 +75,7 @@ function useWhispr(data) {
75
75
  * @param cb The callback to call on value change
76
76
  * @param unsafe If true, the callback will be allowed to throw errors, that will then bubble up
77
77
  */
78
- function useOnWhispr(w, unsafe = false, cb) {
78
+ function useOnWhispr(w, cb, unsafe = false) {
79
79
  (0, react_1.useEffect)(() => {
80
80
  const unsub = w.subscribe(cb, undefined, unsafe);
81
81
  return () => unsub();
@@ -213,11 +213,11 @@ function useAsync(f, data, debouce = 200) {
213
213
  */
214
214
  function useAsyncEffect(f, data, debounce = 200) {
215
215
  const dispatcher = useAsync(f, data, debounce);
216
- useOnWhispr(dispatcher.data, true, (data) => {
216
+ useOnWhispr(dispatcher.data, (data) => {
217
217
  if (!data.loading && !data.ok) {
218
218
  throw data.error;
219
219
  }
220
- });
220
+ }, true);
221
221
  }
222
222
  /**
223
223
  * Format a timestamp into a relative time string (e.g. "5 minutes ago", "in 2 hours"), using the browser locale.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cripty2001/utils",
3
- "version": "0.0.186",
3
+ "version": "0.0.187",
4
4
  "description": "Internal Set of utils. If you need them use them, otherwise go to the next package ;)",
5
5
  "homepage": "https://github.com/cripty2001/utils#readme",
6
6
  "bugs": {