@preact/signals-core
Advanced tools
Comparing version 1.3.0 to 1.3.1
# @preact/signals-core | ||
## 1.3.1 | ||
### Patch Changes | ||
- [#373](https://github.com/preactjs/signals/pull/373) [`8c12a0d`](https://github.com/preactjs/signals/commit/8c12a0df74f00e9cab04e999fc443889b3528c04) Thanks [@rschristian](https://github.com/rschristian)! - Removes package.json#exports.umd, which had invalid paths if they were ever to be consumed | ||
* [#359](https://github.com/preactjs/signals/pull/359) [`26f6526`](https://github.com/preactjs/signals/commit/26f6526875ef0968621c4113594ac95b93de5163) Thanks [@andrewiggins](https://github.com/andrewiggins)! - Change effect callback return type from `void` to `unknown`. Same for effect cleanup function. | ||
## 1.3.0 | ||
@@ -4,0 +12,0 @@ |
@@ -17,3 +17,4 @@ declare function batch<T>(callback: () => T): T; | ||
declare function computed<T>(compute: () => T): ReadonlySignal<T>; | ||
declare function effect(compute: () => void | (() => void)): () => void; | ||
declare type EffectCleanup = () => unknown; | ||
declare function effect(compute: () => unknown | EffectCleanup): () => void; | ||
export { signal, computed, effect, batch, Signal, type ReadonlySignal }; |
{ | ||
"name": "@preact/signals-core", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"license": "MIT", | ||
@@ -31,3 +31,2 @@ "description": "Manage state with style in every framework", | ||
"browser": "./dist/signals-core.module.js", | ||
"umd": "./dist/signals-core.umd.js", | ||
"import": "./dist/signals-core.mjs", | ||
@@ -34,0 +33,0 @@ "require": "./dist/signals-core.js" |
@@ -1,2 +0,1 @@ | ||
# Signals | ||
@@ -25,13 +24,13 @@ | ||
- [Guide / API](#guide--api) | ||
- [`signal(initialValue)`](#signalinitialvalue) | ||
- [`signal.peek()`](#signalpeek) | ||
- [`computed(fn)`](#computedfn) | ||
- [`effect(fn)`](#effectfn) | ||
- [`batch(fn)`](#batchfn) | ||
- [`signal(initialValue)`](#signalinitialvalue) | ||
- [`signal.peek()`](#signalpeek) | ||
- [`computed(fn)`](#computedfn) | ||
- [`effect(fn)`](#effectfn) | ||
- [`batch(fn)`](#batchfn) | ||
- [Preact Integration](./packages/preact/README.md#preact-integration) | ||
- [Hooks](./packages/preact/README.md#hooks) | ||
- [Rendering optimizations](./packages/preact/README.md#rendering-optimizations) | ||
- [Attribute optimization (experimental)](./packages/preact/README.md#attribute-optimization-experimental) | ||
- [Hooks](./packages/preact/README.md#hooks) | ||
- [Rendering optimizations](./packages/preact/README.md#rendering-optimizations) | ||
- [Attribute optimization (experimental)](./packages/preact/README.md#attribute-optimization-experimental) | ||
- [React Integration](./packages/react/README.md#react-integration) | ||
- [Hooks](./packages/react/README.md#hooks) | ||
- [Hooks](./packages/react/README.md#hooks) | ||
- [License](#license) | ||
@@ -38,0 +37,0 @@ |
@@ -672,5 +672,6 @@ function cycleDetected(): never { | ||
type EffectCleanup = () => unknown; | ||
declare class Effect { | ||
_compute?: () => void | (() => void); | ||
_cleanup?: () => void; | ||
_compute?: () => unknown | EffectCleanup; | ||
_cleanup?: () => unknown; | ||
_sources?: Node; | ||
@@ -680,3 +681,3 @@ _nextBatchedEffect?: Effect; | ||
constructor(compute: () => void | (() => void)); | ||
constructor(compute: () => unknown | EffectCleanup); | ||
@@ -689,3 +690,3 @@ _callback(): void; | ||
function Effect(this: Effect, compute: () => void | (() => void)) { | ||
function Effect(this: Effect, compute: () => unknown | EffectCleanup) { | ||
this._compute = compute; | ||
@@ -706,3 +707,3 @@ this._cleanup = undefined; | ||
if (typeof cleanup === "function") { | ||
this._cleanup = cleanup; | ||
this._cleanup = cleanup as EffectCleanup; | ||
} | ||
@@ -745,3 +746,3 @@ } finally { | ||
function effect(compute: () => void | (() => void)): () => void { | ||
function effect(compute: () => unknown | EffectCleanup): () => void { | ||
const effect = new Effect(compute); | ||
@@ -748,0 +749,0 @@ try { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
2292
0
205862
15
207