arrow-of-time
Advanced tools
Comparing version 0.1.2 to 0.1.3
27
index.js
@@ -601,2 +601,6 @@ module.exports = | ||
eject: function eject() { | ||
return snapshot; | ||
}, | ||
getState: function getState() { | ||
@@ -631,8 +635,21 @@ return snapshot.getState(); | ||
return function (snapshot) { | ||
return _extends({}, store(subscribe(function (snapshot) { | ||
return subscribers.forEach(function (f) { | ||
return f(snapshot); | ||
}); | ||
})(snapshot)), { | ||
var plainStore = store(snapshot); | ||
return _extends({}, plainStore, { | ||
dispatch: function dispatch(x) { | ||
plainStore.dispatch(x); | ||
subscribers.forEach(function (callback) { | ||
return callback(_extends({}, plainStore.eject(), plainStore)); | ||
}); | ||
}, | ||
update: function update(f) { | ||
plainStore.update(f); | ||
subscribers.forEach(function (callback) { | ||
return callback(_extends({}, plainStore.eject(), plainStore)); | ||
}); | ||
}, | ||
subscribe: function subscribe(callback) { | ||
@@ -639,0 +656,0 @@ subscribers.push(callback); |
{ | ||
"name": "arrow-of-time", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Experiment with minimum possible composable implementation of a history (such as a Redux store, Act history, etc).", | ||
"main": "index.js", | ||
"scripts": { | ||
"clean": "git clean -f && rm -rf demo && rm -rf store && rm -rf timeline && rm -rf snapshot", | ||
"test": "npm run test:lint && npm run test:unit", | ||
@@ -8,0 +9,0 @@ "build": "sagui build", |
@@ -81,5 +81,5 @@ # Arrow of time | ||
timeline.rewind() | ||
timeline.rewind() | ||
timeline.redo() | ||
timelines.push(timelines[2].rewind()) | ||
timelines.push(timelines[3].rewind()) | ||
timelines.push(timelines[4].redo()) | ||
``` | ||
@@ -86,0 +86,0 @@ |
@@ -10,2 +10,4 @@ import _subscribable from './subscribable' | ||
eject: () => snapshot, | ||
getState: () => snapshot.getState(), | ||
@@ -12,0 +14,0 @@ |
@@ -5,11 +5,24 @@ export default (subscribe) => (store) => { | ||
return (snapshot) => { | ||
const plainStore = store(snapshot) | ||
return { | ||
...store( | ||
subscribe( | ||
(snapshot) => subscribers.forEach((f) => f(snapshot)) | ||
)( | ||
snapshot | ||
) | ||
), | ||
...plainStore, | ||
dispatch: (x) => { | ||
plainStore.dispatch(x) | ||
subscribers.forEach((callback) => callback({ | ||
...plainStore.eject(), | ||
...plainStore | ||
})) | ||
}, | ||
update: (f) => { | ||
plainStore.update(f) | ||
subscribers.forEach((callback) => callback({ | ||
...plainStore.eject(), | ||
...plainStore | ||
})) | ||
}, | ||
subscribe: (callback) => { | ||
@@ -16,0 +29,0 @@ subscribers.push(callback) |
@@ -75,2 +75,6 @@ module.exports = | ||
eject: function eject() { | ||
return snapshot; | ||
}, | ||
getState: function getState() { | ||
@@ -105,8 +109,21 @@ return snapshot.getState(); | ||
return function (snapshot) { | ||
return _extends({}, store(subscribe(function (snapshot) { | ||
return subscribers.forEach(function (f) { | ||
return f(snapshot); | ||
}); | ||
})(snapshot)), { | ||
var plainStore = store(snapshot); | ||
return _extends({}, plainStore, { | ||
dispatch: function dispatch(x) { | ||
plainStore.dispatch(x); | ||
subscribers.forEach(function (callback) { | ||
return callback(_extends({}, plainStore.eject(), plainStore)); | ||
}); | ||
}, | ||
update: function update(f) { | ||
plainStore.update(f); | ||
subscribers.forEach(function (callback) { | ||
return callback(_extends({}, plainStore.eject(), plainStore)); | ||
}); | ||
}, | ||
subscribe: function subscribe(callback) { | ||
@@ -113,0 +130,0 @@ subscribers.push(callback); |
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1856515
22609