nabd 1.0.2 → 1.0.3

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/dist/index.d.mts CHANGED
@@ -40,7 +40,7 @@ declare const batch: (fn: () => void) => void;
40
40
  /**
41
41
  * Executes an async task. If it fails, reverts signals to their previous state.
42
42
  */
43
- declare function withReversion(signals: Signal<any>[], task: () => Promise<void>): Promise<void>;
43
+ declare function withReversion<R>(signals: Signal<any>[], task: () => Promise<R>): Promise<R>;
44
44
 
45
45
  declare class ReadOnlySignal<T> {
46
46
  protected ref: Signal<T> | Computed<T>;
package/dist/index.d.ts CHANGED
@@ -40,7 +40,7 @@ declare const batch: (fn: () => void) => void;
40
40
  /**
41
41
  * Executes an async task. If it fails, reverts signals to their previous state.
42
42
  */
43
- declare function withReversion(signals: Signal<any>[], task: () => Promise<void>): Promise<void>;
43
+ declare function withReversion<R>(signals: Signal<any>[], task: () => Promise<R>): Promise<R>;
44
44
 
45
45
  declare class ReadOnlySignal<T> {
46
46
  protected ref: Signal<T> | Computed<T>;
package/dist/index.js CHANGED
@@ -158,7 +158,7 @@ var batch = (fn) => {
158
158
  async function withReversion(signals, task) {
159
159
  const snapshots = signals.map((s) => s.peek());
160
160
  try {
161
- await task();
161
+ return await task();
162
162
  } catch (error) {
163
163
  batch(() => {
164
164
  signals.forEach((s, i) => s.set(snapshots[i]));
package/dist/index.mjs CHANGED
@@ -116,7 +116,7 @@ var batch = (fn) => {
116
116
  async function withReversion(signals, task) {
117
117
  const snapshots = signals.map((s) => s.peek());
118
118
  try {
119
- await task();
119
+ return await task();
120
120
  } catch (error) {
121
121
  batch(() => {
122
122
  signals.forEach((s, i) => s.set(snapshots[i]));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nabd",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "A lightweight, high-performance reactivity engine designed mostly for Fintech applications. Built for precision, speed, and safety.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",