@maverick-js/signals
Advanced tools
Comparing version 5.0.3 to 5.0.4
@@ -243,7 +243,6 @@ // src/scheduler.ts | ||
try { | ||
return compute(fn[SCOPE], fn, currentObserver); | ||
compute(fn[SCOPE], fn, currentObserver); | ||
} catch (error) { | ||
handleError(fn, error); | ||
} | ||
return; | ||
}; | ||
@@ -311,3 +310,3 @@ } | ||
prevObserver = null; | ||
if (true) | ||
if (scope2) | ||
computeStack.pop(); | ||
@@ -314,0 +313,0 @@ } |
@@ -241,7 +241,6 @@ // src/scheduler.ts | ||
try { | ||
return compute(fn[SCOPE], fn, currentObserver); | ||
compute(fn[SCOPE], fn, currentObserver); | ||
} catch (error) { | ||
handleError(fn, error); | ||
} | ||
return; | ||
}; | ||
@@ -248,0 +247,0 @@ } |
@@ -196,11 +196,7 @@ /** | ||
* Scopes the given function to the current parent scope so context and error handling continue to | ||
* work as expected. Generally this should be called on non-signal functions. A scoped | ||
* function will return `undefined` if an error is thrown. | ||
* work as expected. | ||
* | ||
* This is more compute and memory efficient than the alternative `effect(() => peek(callback))` | ||
* because it doesn't require creating and tracking a `computed` signal. | ||
* | ||
* @see {@link https://github.com/maverick-js/signals#scope} | ||
*/ | ||
export declare function scope<T>(fn: () => T): () => T | undefined; | ||
export declare function scope(fn: () => void): () => void; | ||
@@ -207,0 +203,0 @@ /** |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "5.0.3", | ||
"version": "5.0.4", | ||
"type": "module", | ||
@@ -8,0 +8,0 @@ "module": "dist/prod/index.js", |
@@ -516,8 +516,4 @@ # Signals | ||
Scopes the given function to the current parent scope so context and error handling continue to | ||
work as expected. Generally this should be called on non-signal functions. A scoped function will | ||
return `undefined` if an error is thrown. | ||
work as expected. | ||
This is more compute and memory efficient than the alternative `effect(() => peek(callback))` | ||
because it doesn't require creating and tracking a `computed` signal. | ||
```js | ||
@@ -529,3 +525,3 @@ import { root, scope } from '@maverick-js/signals'; | ||
root(() => { | ||
// This is now scoped to root. | ||
// The callback is now scoped to root. | ||
callback = scope(() => { | ||
@@ -532,0 +528,0 @@ // Context and error handling will work here. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59372
1209
738