mquan/cortex

Exposing diffs

Closed this issue · 3 comments

Hello and thanks for the 'cortex'!
Would it be possible to expose the changes/updates that the state has undergone. For instance in the simple example, the 'on update' let's you update the props.
orderCortex.on("update", function(updatedOrder) {
orderComponent.setProps({order: updatedOrder});
});
I think having a function to get the difference between formerOrder and the updatedOrder could be useful. For instance when some 'root component' needs to communicate the changes it has undergone to another 'root component'.

This is a good idea, it's definitely high on my feature list

It's also useful in a situation where you want to send JSON data to a server and only provide the changes around your data structure, rather than the entire thing.

Sorry this is long overdue but this feature is finally available in this commit 4fcfc56

Please check out the documentation in README