Comparing version 3.0.7 to 3.1.0
# Change Log | ||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
## 3.1 | ||
* Added third argument to event handler with store (by @octav47). | ||
## 3.0.7 | ||
@@ -5,0 +8,0 @@ * Fixed `package.types` path. |
@@ -71,3 +71,4 @@ type DataTypes<Map, Key extends keyof Map> = Map extends never | ||
state: State extends object ? Readonly<State> : State, | ||
data: (Events & StoreonEvents<State, Events>)[Event] | ||
data: (Events & StoreonEvents<State, Events>)[Event], | ||
store: StoreonStore | ||
) => Partial<State> | Promise<void> | null | void | ||
@@ -74,0 +75,0 @@ |
@@ -15,3 +15,3 @@ let createStoreon = modules => { | ||
events[event].forEach(i => { | ||
let diff = events[event].includes(i) && i(state, data) | ||
let diff = events[event].includes(i) && i(state, data, store) | ||
if (diff && typeof diff.then !== 'function') { | ||
@@ -18,0 +18,0 @@ changed = state = { ...state, ...diff } |
{ | ||
"name": "storeon", | ||
"version": "3.0.7", | ||
"description": "Tiny (167 bytes) event-based Redux-like state manager for React and Preact", | ||
"version": "3.1.0", | ||
"description": "Tiny (185 bytes) event-based Redux-like state manager for React and Preact", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "state", |
@@ -9,3 +9,3 @@ # Storeon | ||
* **Small.** 167 bytes (minified and gzipped). No dependencies. | ||
* **Small.** 185 bytes (minified and gzipped). No dependencies. | ||
It uses [Size Limit] to control size. | ||
@@ -183,4 +183,4 @@ * **Fast.** It tracks what parts of state were changed and re-renders | ||
An event listener accepts the current state as the first argument | ||
and optional event object as the second. | ||
An event listener accepts the current state as the first argument, | ||
optional event object as the second and optional store object as the third. | ||
@@ -187,0 +187,0 @@ So event listeners can be reducers as well. As in Redux’s reducers, |
Sorry, the diff of this file is not supported yet
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
39222
753