nanostores
Advanced tools
Comparing version 0.10.0 to 0.10.1
@@ -19,5 +19,6 @@ import type { MapStore, Store, StoreValue } from '../map/index.js' | ||
type AtomNotifyPayload<Shared> = { | ||
type AtomNotifyPayload<Shared, SomeStore extends Store> = { | ||
abort(): void | ||
changed: undefined | ||
oldValue: StoreValue<SomeStore> | ||
shared: Shared | ||
@@ -30,5 +31,6 @@ } | ||
changed: keyof StoreValue<SomeStore> | ||
oldValue: StoreValue<SomeStore> | ||
shared: Shared | ||
} | ||
| AtomNotifyPayload<Shared> | ||
| AtomNotifyPayload<Shared, SomeStore> | ||
@@ -68,3 +70,3 @@ /** | ||
/** | ||
* Add listener to notifing about store changes. | ||
* Add listener to notifying about store changes. | ||
* | ||
@@ -85,3 +87,3 @@ * You can communicate between listeners by `payload.shared` | ||
? MapNotifyPayload<Shared, SomeStore> | ||
: AtomNotifyPayload<Shared> | ||
: AtomNotifyPayload<Shared, SomeStore> | ||
) => void | ||
@@ -88,0 +90,0 @@ ): () => void |
@@ -101,3 +101,3 @@ import { clean } from '../clean-stores/index.js' | ||
let originNotify = $store.notify | ||
$store.notify = (_, changed) => { | ||
$store.notify = (oldValue, changed) => { | ||
let isAborted | ||
@@ -108,4 +108,4 @@ let abort = () => { | ||
runListeners({ abort, changed }) | ||
if (!isAborted) return originNotify(changed) | ||
runListeners({ abort, changed, oldValue }) | ||
if (!isAborted) return originNotify(oldValue, changed) | ||
} | ||
@@ -112,0 +112,0 @@ return () => { |
{ | ||
"name": "nanostores", | ||
"version": "0.10.0", | ||
"version": "0.10.1", | ||
"description": "A tiny (286 bytes) state manager for React/Preact/Vue/Svelte with many atomic tree-shakable stores", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
39722
1315