diff --git a/package.json b/package.json index 4345921..f8e1537 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "bundlesize": [ { "path": "full/preact.js", - "maxSize": "760b" + "maxSize": "785b" }, { "path": "dist/unistore.js", diff --git a/src/index.js b/src/index.js index 4df2006..6409290 100644 --- a/src/index.js +++ b/src/index.js @@ -28,10 +28,10 @@ export default function createStore(state) { listeners = out; } - function setState(update, overwrite, action) { + function setState(update, overwrite, action, params) { state = overwrite ? update : assign(assign({}, state), update); let currentListeners = listeners; - for (let i=0; i { expect(rval).toBeInstanceOf(Function); store.setState({ a: 'b' }); - expect(sub1).toBeCalledWith(store.getState(), action); + expect(sub1).toBeCalledWith(store.getState(), action, { a: 'b' }, undefined); store.subscribe(sub2); store.setState({ c: 'd' }); expect(sub1).toHaveBeenCalledTimes(2); - expect(sub1).toHaveBeenLastCalledWith(store.getState(), action); - expect(sub2).toBeCalledWith(store.getState(), action); + expect(sub1).toHaveBeenLastCalledWith(store.getState(), action, { c: 'd' }, undefined); + expect(sub2).toBeCalledWith(store.getState(), action, { c: 'd' }, undefined); }); it('should unsubscribe', () => {